[PATCH] D91633: SpeculativeExecution: Allow speculating more instructions types

Piotr Sobczak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 17 07:45:31 PST 2020


piotr created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
piotr requested review of this revision.

Support more instructions in SpeculativeExecution pass:

- ExtractElement
- InsertElement
- ShuffleVector


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91633

Files:
  llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
  llvm/test/Transforms/SpeculativeExecution/spec-fp.ll


Index: llvm/test/Transforms/SpeculativeExecution/spec-fp.ll
===================================================================
--- llvm/test/Transforms/SpeculativeExecution/spec-fp.ll
+++ llvm/test/Transforms/SpeculativeExecution/spec-fp.ll
@@ -99,3 +99,46 @@
 b:
   ret void
 }
+
+; CHECK-LABEL: @ifThen_shuffle(
+; CHECK: shufflevector
+; CHECK: br i1 true
+define void @ifThen_shuffle() {
+  br i1 true, label %a, label %b
+
+a:
+  %x = shufflevector <2 x float> undef, <2 x float> undef, <2 x i32> zeroinitializer
+  br label %b
+
+b:
+  ret void
+}
+
+; CHECK-LABEL: @ifThen_extract(
+; CHECK: extractelement
+; CHECK: br i1 true
+define void @ifThen_extract() {
+  br i1 true, label %a, label %b
+
+a:
+  %x = extractelement <2 x float> undef, i32 1
+  br label %b
+
+b:
+  ret void
+}
+
+
+; CHECK-LABEL: @ifThen_insert(
+; CHECK: insertelement
+; CHECK: br i1 true
+define void @ifThen_insert() {
+  br i1 true, label %a, label %b
+
+a:
+  %x = insertelement <2 x float> undef, float undef, i32 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
@@ -245,6 +245,9 @@
     case Instruction::FNeg:
     case Instruction::ICmp:
     case Instruction::FCmp:
+    case Instruction::ExtractElement:
+    case Instruction::InsertElement:
+    case Instruction::ShuffleVector:
       return TTI.getUserCost(I, TargetTransformInfo::TCK_SizeAndLatency);
 
     default:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91633.305796.patch
Type: text/x-patch
Size: 1594 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201117/a386a8d1/attachment.bin>


More information about the llvm-commits mailing list