diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2019-12-06 14:20:44 -0500 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2019-12-06 14:20:44 -0500 |
| commit | b6d6f5470f281db4716db8b2306113924afc6887 (patch) | |
| tree | 49c48bdec84d6c8187aac6ec44634533a82c7e09 /llvm/lib/Transforms | |
| parent | 142a75a9b16632d5bad60ae50b9171bfddbe422a (diff) | |
| download | bcm5719-llvm-b6d6f5470f281db4716db8b2306113924afc6887.tar.gz bcm5719-llvm-b6d6f5470f281db4716db8b2306113924afc6887.zip | |
Revert "[InstCombine] improve readability; NFC"
This reverts commit 7250ef3613cc6b81145b9543bafb86d7f9466cde.
At least 1 of these supposedly NFC commits wasn't - sanitizer bot is angry.
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index 1ba017d479e..a3c1b2777e3 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -863,15 +863,19 @@ Instruction *InstCombiner::transformZExtICmp(ICmpInst *Cmp, ZExtInst &Zext, (Pred == ICmpInst::ICMP_SGT && Op1C->isAllOnesValue())) { if (!DoTransform) return Cmp; + Value *In = Op0; Value *ShAmt = ConstantInt::get(CmpOpType, CmpOpType->getScalarSizeInBits() - 1); - Value *Sh = Builder.CreateLShr(Op0, ShAmt, Op0->getName() + ".lobit"); - Value *Cast = Builder.CreateIntCast(Sh, ZType, false /*ZExt*/); - // Invert low bit if testing for positive. - if (Pred == ICmpInst::ICMP_SGT) - Cast = Builder.CreateXor(Cast, ConstantInt::get(CmpOpType, 1)); + In = Builder.CreateLShr(In, ShAmt, In->getName() + ".lobit"); + if (CmpOpType != ZType) + In = Builder.CreateIntCast(In, ZType, false /*ZExt*/); - return replaceInstUsesWith(Zext, Cast); + if (Pred == ICmpInst::ICMP_SGT) { + Constant *One = ConstantInt::get(CmpOpType, 1); + In = Builder.CreateXor(In, One, In->getName() + ".not"); + } + + return replaceInstUsesWith(Zext, In); } // zext (X == 0) to i32 --> X^1 iff X has only the low bit set. |

