diff options
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | 4 | ||||
-rw-r--r-- | llvm/test/Transforms/InstCombine/select_meta.ll | 2 | ||||
-rw-r--r-- | llvm/test/Transforms/LoopVectorize/reduction.ll | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp index dc8e8df421e..f1f2a6606e2 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -354,7 +354,9 @@ Instruction *InstCombiner::foldSelectOpOp(SelectInst &SI, Instruction *TI, Value *Op0 = MatchIsOpZero ? MatchOp : NewSI; Value *Op1 = MatchIsOpZero ? NewSI : MatchOp; if (auto *BO = dyn_cast<BinaryOperator>(TI)) { - return BinaryOperator::Create(BO->getOpcode(), Op0, Op1); + BinaryOperator *NewBO = BinaryOperator::Create(BO->getOpcode(), Op0, Op1); + NewBO->copyIRFlags(BO); + return NewBO; } if (auto *TGEP = dyn_cast<GetElementPtrInst>(TI)) { auto *FGEP = cast<GetElementPtrInst>(FI); diff --git a/llvm/test/Transforms/InstCombine/select_meta.ll b/llvm/test/Transforms/InstCombine/select_meta.ll index d11b8310c3d..28caac45f96 100644 --- a/llvm/test/Transforms/InstCombine/select_meta.ll +++ b/llvm/test/Transforms/InstCombine/select_meta.ll @@ -7,7 +7,7 @@ define i32 @foo(i32) local_unnamed_addr #0 { ; CHECK-LABEL: @foo( ; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 %0, 2 ; CHECK-NEXT: [[DOTV:%.*]] = select i1 [[TMP2]], i32 20, i32 -20, !prof ![[$MD1:[0-9]+]] -; CHECK-NEXT: [[TMP3:%.*]] = add i32 [[DOTV]], %0 +; CHECK-NEXT: [[TMP3:%.*]] = add nsw i32 [[DOTV]], %0 ; CHECK-NEXT: ret i32 [[TMP3]] ; %2 = icmp sgt i32 %0, 2 diff --git a/llvm/test/Transforms/LoopVectorize/reduction.ll b/llvm/test/Transforms/LoopVectorize/reduction.ll index 994ea03e39a..1246cd5ca82 100644 --- a/llvm/test/Transforms/LoopVectorize/reduction.ll +++ b/llvm/test/Transforms/LoopVectorize/reduction.ll @@ -325,7 +325,7 @@ for.end: ; preds = %for.body, %entry ; We can vectorize conditional reductions with multi-input phis. ; CHECK: reduction_conditional -; CHECK: fadd <4 x float> +; CHECK: fadd fast <4 x float> define float @reduction_conditional(float* %A, float* %B, float* %C, float %S) { entry: |