[PATCH] D74825: SpeculativeExecution: fixed ingoring free execution
Daniil Fukalov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 19 03:37:17 PST 2020
dfukalov created this revision.
dfukalov added reviewers: arsenm, chandlerc.
Herald added subscribers: kerbowa, hiraditya, tpr, nhaehnle, wdng, jvesely.
Herald added a project: LLVM.
After updating cost model in AMDGPU target (47a5c36b37f0 <https://reviews.llvm.org/rG47a5c36b37f033496de01b48cef0b2f1903c33cc>) the pass started to
ignore some BBs since they got all instructions estimated as free.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D74825
Files:
llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
llvm/test/CodeGen/AMDGPU/speculative-execution-freecasts.ll
Index: llvm/test/CodeGen/AMDGPU/speculative-execution-freecasts.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AMDGPU/speculative-execution-freecasts.ll
@@ -0,0 +1,30 @@
+; RUN: opt < %s -S -mtriple=amdgcn-unknown-amdhsa -speculative-execution \
+; RUN: -spec-exec-max-speculation-cost 4 -spec-exec-max-not-hoisted 3 \
+; RUN: | FileCheck %s
+
+; CHECK-LABEL: @ifThen_bitcast(
+; CHECK: bitcast
+; CHECK: br i1 true
+define void @ifThen_bitcast() {
+ br i1 true, label %a, label %b
+
+a:
+ %x = bitcast i32 undef to float
+ br label %b
+
+b:
+ ret void
+}
+
+; CHECK-LABEL: @ifThen_addrspacecast(
+; CHECK: addrspacecast
+; CHECK: br i1 true
+define void @ifThen_addrspacecast() {
+ br i1 true, label %a, label %b
+a:
+ %x = addrspacecast i32* undef to i32 addrspace(1)*
+ br label %b
+
+b:
+ ret void
+}
Index: llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
+++ llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
@@ -279,9 +279,6 @@
}
}
- if (TotalSpeculationCost == 0)
- return false; // nothing to hoist
-
for (auto I = FromBlock.begin(); I != FromBlock.end();) {
// We have to increment I before moving Current as moving Current
// changes the list that I is iterating through.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74825.245369.patch
Type: text/x-patch
Size: 1411 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200219/e4716d8e/attachment.bin>
More information about the llvm-commits
mailing list