diff options
author | Sanjay Patel <spatel@rotateright.com> | 2018-07-10 16:09:49 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2018-07-10 16:09:49 +0000 |
commit | c8d9d812ec30345c175587608944c7976eda2ebb (patch) | |
tree | a267833551255b1411b4272964b9179cb6ae6a84 /llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp | |
parent | f0642bfe449a57f993df023bdf14dc275a7592e3 (diff) | |
download | bcm5719-llvm-c8d9d812ec30345c175587608944c7976eda2ebb.tar.gz bcm5719-llvm-c8d9d812ec30345c175587608944c7976eda2ebb.zip |
[InstCombine] allow flag propagation when using safe constant
This corresponds with the code for the single binop pattern
added in rL336684.
llvm-svn: 336696
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp index 8fecd6904c3..2560feb37d6 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp @@ -1339,12 +1339,13 @@ static Instruction *foldSelectShuffle(ShuffleVectorInst &Shuf, // Flags are intersected from the 2 source binops. But there are 2 exceptions: // 1. If we changed an opcode, poison conditions might have changed. // 2. If the shuffle had undef mask elements, the new binop might have undefs - // where the original code did not. Drop all poison potential to be safe. + // where the original code did not. But if we already made a safe constant, + // then there's no danger. NewBO->copyIRFlags(B0); NewBO->andIRFlags(B1); if (DropNSW) NewBO->setHasNoSignedWrap(false); - if (Mask->containsUndefElement()) + if (Mask->containsUndefElement() && !MightCreatePoisonOrUB) NewBO->dropPoisonGeneratingFlags(); return NewBO; } |