SpeculativeExecution: Allow speculating more instruction types

Support more instructions in SpeculativeExecution pass:
- ExtractElement
- InsertElement
- ShuffleVector

Differential Revision: https://reviews.llvm.org/D91633
This commit is contained in:
Piotr Sobczak 2020-11-17 15:38:44 +01:00
parent 9d77584fe0
commit c173f1b8eb
2 changed files with 46 additions and 0 deletions

View File

@ -245,6 +245,9 @@ static unsigned ComputeSpeculationCost(const Instruction *I,
case Instruction::FNeg: case Instruction::FNeg:
case Instruction::ICmp: case Instruction::ICmp:
case Instruction::FCmp: case Instruction::FCmp:
case Instruction::ExtractElement:
case Instruction::InsertElement:
case Instruction::ShuffleVector:
return TTI.getUserCost(I, TargetTransformInfo::TCK_SizeAndLatency); return TTI.getUserCost(I, TargetTransformInfo::TCK_SizeAndLatency);
default: default:

View File

@ -99,3 +99,46 @@ a:
b: b:
ret void 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
}