[PATCH] D74825: SpeculativeExecution: fixed ingoring free execution

Daniil Fukalov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 20 03:48:07 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGdbfc682e2ba2: SpeculativeExecution: fixed ingoring free execution (authored by dfukalov).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74825/new/

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 1 -spec-exec-max-not-hoisted 1 \
+; RUN:   | FileCheck %s
+
+; CHECK-LABEL: @ifThen_bitcast(
+; CHECK: bitcast
+; CHECK: br i1 true
+define void @ifThen_bitcast(i32 %y) {
+  br i1 true, label %a, label %b
+
+a:
+  %x = bitcast i32 %y to float
+  br label %b
+
+b:
+  ret void
+}
+
+; CHECK-LABEL: @ifThen_addrspacecast(
+; CHECK: addrspacecast
+; CHECK: br i1 true
+define void @ifThen_addrspacecast(i32* %y) {
+  br i1 true, label %a, label %b
+a:
+  %x = addrspacecast i32* %y 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.245613.patch
Type: text/x-patch
Size: 1418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200220/03057d72/attachment.bin>


More information about the llvm-commits mailing list