diff --git a/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp b/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp --- a/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp +++ b/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp @@ -245,9 +245,13 @@ case Instruction::FNeg: case Instruction::ICmp: case Instruction::FCmp: + case Instruction::Trunc: + case Instruction::Freeze: case Instruction::ExtractElement: case Instruction::InsertElement: case Instruction::ShuffleVector: + case Instruction::ExtractValue: + case Instruction::InsertValue: return TTI.getUserCost(I, TargetTransformInfo::TCK_SizeAndLatency); default: diff --git a/llvm/test/Transforms/SpeculativeExecution/spec-casts.ll b/llvm/test/Transforms/SpeculativeExecution/spec-casts.ll --- a/llvm/test/Transforms/SpeculativeExecution/spec-casts.ll +++ b/llvm/test/Transforms/SpeculativeExecution/spec-casts.ll @@ -134,3 +134,16 @@ b: ret void } + +; CHECK-LABEL: @ifThen_trunc( +; CHECK: trunc +; CHECK: br i1 true +define void @ifThen_trunc() { + br i1 true, label %a, label %b +a: + %x = trunc i32 undef to i16 + br label %b + +b: + ret void +} diff --git a/llvm/test/Transforms/SpeculativeExecution/spec-fp.ll b/llvm/test/Transforms/SpeculativeExecution/spec-fp.ll --- a/llvm/test/Transforms/SpeculativeExecution/spec-fp.ll +++ b/llvm/test/Transforms/SpeculativeExecution/spec-fp.ll @@ -99,46 +99,3 @@ 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 -} diff --git a/llvm/test/Transforms/SpeculativeExecution/spec-fp.ll b/llvm/test/Transforms/SpeculativeExecution/spec-other.ll copy from llvm/test/Transforms/SpeculativeExecution/spec-fp.ll copy to llvm/test/Transforms/SpeculativeExecution/spec-other.ll --- a/llvm/test/Transforms/SpeculativeExecution/spec-fp.ll +++ b/llvm/test/Transforms/SpeculativeExecution/spec-other.ll @@ -2,141 +2,85 @@ ; RUN: -spec-exec-max-speculation-cost 4 -spec-exec-max-not-hoisted 3 \ ; RUN: | FileCheck %s -; CHECK-LABEL: @ifThen_fadd( -; CHECK: fadd -; CHECK: br i1 true -define void @ifThen_fadd() { - br i1 true, label %a, label %b - -a: - %x = fadd float undef, undef - br label %b - -b: - ret void -} - -; CHECK-LABEL: @ifThen_fsub( -; CHECK: fsub -; CHECK: br i1 true -define void @ifThen_fsub() { - br i1 true, label %a, label %b - -a: - %x = fsub float undef, undef - br label %b - -b: - ret void -} - -; CHECK-LABEL: @ifThen_binary_fneg( -; CHECK: fsub float -0.0 -; CHECK: br i1 true -define void @ifThen_binary_fneg() { - br i1 true, label %a, label %b - -a: - %x = fsub float -0.0, undef - br label %b - -b: - ret void -} - -; CHECK-LABEL: @ifThen_unary_fneg( -; CHECK: fneg float +; CHECK-LABEL: @ifThen_shuffle( +; CHECK: shufflevector ; CHECK: br i1 true -define void @ifThen_unary_fneg() { +define void @ifThen_shuffle() { br i1 true, label %a, label %b a: - %x = fneg float undef + %x = shufflevector <2 x float> undef, <2 x float> undef, <2 x i32> zeroinitializer br label %b b: ret void } -; CHECK-LABEL: @ifThen_fmul( -; CHECK: fmul +; CHECK-LABEL: @ifThen_extract( +; CHECK: extractelement ; CHECK: br i1 true -define void @ifThen_fmul() { +define void @ifThen_extract() { br i1 true, label %a, label %b a: - %x = fmul float undef, undef + %x = extractelement <2 x float> undef, i32 1 br label %b b: ret void } -; CHECK-LABEL: @ifThen_fdiv( -; CHECK: fdiv -; CHECK: br i1 true -define void @ifThen_fdiv() { - br i1 true, label %a, label %b - -a: - %x = fdiv float undef, undef - br label %b - -b: - ret void -} -; CHECK-LABEL: @ifThen_frem( -; CHECK: frem +; CHECK-LABEL: @ifThen_insert( +; CHECK: insertelement ; CHECK: br i1 true -define void @ifThen_frem() { +define void @ifThen_insert() { br i1 true, label %a, label %b a: - %x = frem float undef, undef + %x = insertelement <2 x float> undef, float undef, i32 1 br label %b b: ret void } -; CHECK-LABEL: @ifThen_shuffle( -; CHECK: shufflevector +; CHECK-LABEL: @ifThen_extractvalue( +; CHECK: extractvalue ; CHECK: br i1 true -define void @ifThen_shuffle() { +define void @ifThen_extractvalue() { br i1 true, label %a, label %b a: - %x = shufflevector <2 x float> undef, <2 x float> undef, <2 x i32> zeroinitializer + %x = extractvalue { i32, i32 } undef, 0 br label %b b: ret void } -; CHECK-LABEL: @ifThen_extract( -; CHECK: extractelement +; CHECK-LABEL: @ifThen_insertvalue( +; CHECK: insertvalue ; CHECK: br i1 true -define void @ifThen_extract() { +define void @ifThen_insertvalue() { br i1 true, label %a, label %b a: - %x = extractelement <2 x float> undef, i32 1 + %x = insertvalue { i32, i32 } undef, i32 undef, 0 br label %b b: ret void } - -; CHECK-LABEL: @ifThen_insert( -; CHECK: insertelement +; CHECK-LABEL: @ifThen_freeze( +; CHECK: freeze ; CHECK: br i1 true -define void @ifThen_insert() { +define void @ifThen_freeze() { br i1 true, label %a, label %b a: - %x = insertelement <2 x float> undef, float undef, i32 1 + %x = freeze i32 undef br label %b b: