Skip to content

Commit dbfc682

Browse files
committed
SpeculativeExecution: fixed ingoring free execution
Summary: After updating cost model in AMDGPU target (47a5c36) the pass started to ignore some BBs since they got all instructions estimated as free. Reviewers: arsenm, chandlerc, nhaehnle Reviewed By: nhaehnle Subscribers: jvesely, wdng, nhaehnle, tpr, hiraditya, kerbowa, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D74825
1 parent c8f9e52 commit dbfc682

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,6 @@ bool SpeculativeExecutionPass::considerHoistingFromTo(
279279
}
280280
}
281281

282-
if (TotalSpeculationCost == 0)
283-
return false; // nothing to hoist
284-
285282
for (auto I = FromBlock.begin(); I != FromBlock.end();) {
286283
// We have to increment I before moving Current as moving Current
287284
// changes the list that I is iterating through.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
; RUN: opt < %s -S -mtriple=amdgcn-unknown-amdhsa -speculative-execution \
2+
; RUN: -spec-exec-max-speculation-cost 1 -spec-exec-max-not-hoisted 1 \
3+
; RUN: | FileCheck %s
4+
5+
; CHECK-LABEL: @ifThen_bitcast(
6+
; CHECK: bitcast
7+
; CHECK: br i1 true
8+
define void @ifThen_bitcast(i32 %y) {
9+
br i1 true, label %a, label %b
10+
11+
a:
12+
%x = bitcast i32 %y to float
13+
br label %b
14+
15+
b:
16+
ret void
17+
}
18+
19+
; CHECK-LABEL: @ifThen_addrspacecast(
20+
; CHECK: addrspacecast
21+
; CHECK: br i1 true
22+
define void @ifThen_addrspacecast(i32* %y) {
23+
br i1 true, label %a, label %b
24+
a:
25+
%x = addrspacecast i32* %y to i32 addrspace(1)*
26+
br label %b
27+
28+
b:
29+
ret void
30+
}

0 commit comments

Comments
 (0)