summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
diff options
context:
space:
mode:
authorMichael Berg <michael_c_berg@apple.com>2018-08-16 20:59:45 +0000
committerMichael Berg <michael_c_berg@apple.com>2018-08-16 20:59:45 +0000
commited89d069f4d6be2913ef5a1ae8fd2f9b28ddaab2 (patch)
tree3930f544b6ac26b2f941b3b4b839a3b53c15dfff /llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
parent5f50ffe83b3269d03b495daeb2a73ca9f87f39e3 (diff)
downloadbcm5719-llvm-ed89d069f4d6be2913ef5a1ae8fd2f9b28ddaab2.tar.gz
bcm5719-llvm-ed89d069f4d6be2913ef5a1ae8fd2f9b28ddaab2.zip
add a missed case for binary op FMF propagation under select folds
llvm-svn: 339938
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp4
1 files changed, 3 insertions, 1 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);
OpenPOWER on IntegriCloud