diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2019-08-18 12:26:33 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2019-08-18 12:26:33 +0000 |
commit | 9b957d332171d4daadf1906b18646f05366584d4 (patch) | |
tree | 52e2f94000d4ff7cc215ce43fc3d504066d2e265 /llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | |
parent | b4806822d2d52e0e7a29ba1c15a435e2e97a82e7 (diff) | |
download | bcm5719-llvm-9b957d332171d4daadf1906b18646f05366584d4.tar.gz bcm5719-llvm-9b957d332171d4daadf1906b18646f05366584d4.zip |
[InstCombine] Cherry-pick NFC cleanups of foldShiftIntoShiftInAnotherHandOfAndInICmp() from D66383
llvm-svn: 369207
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index babbd9df908..620b5563804 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -3321,12 +3321,15 @@ foldShiftIntoShiftInAnotherHandOfAndInICmp(ICmpInst &I, const SimplifyQuery SQ, m_Instruction(MaybeTruncation))))) return nullptr; - Instruction *UntruncatedShift = XShift; - // We potentially looked past 'trunc', but only when matching YShift, // therefore YShift must have the widest type. - Type *WidestTy = YShift->getType(); - assert(XShift->getType() == I.getOperand(0)->getType() && + Instruction *WidestShift = YShift; + // Therefore XShift must have the shallowest type. + // Or they both have identical types if there was no truncation. + Instruction *NarrowestShift = XShift; + + Type *WidestTy = WidestShift->getType(); + assert(NarrowestShift->getType() == I.getOperand(0)->getType() && "We did not look past any shifts while matching XShift though."); bool HadTrunc = WidestTy != I.getOperand(0)->getType(); @@ -3363,7 +3366,7 @@ foldShiftIntoShiftInAnotherHandOfAndInICmp(ICmpInst &I, const SimplifyQuery SQ, // Due to the 'trunc', we will need to widen X. For that either the old // 'trunc' or the shift amt in the non-truncated shift should be one-use. if (!MaybeTruncation->hasOneUse() && - !UntruncatedShift->getOperand(1)->hasOneUse()) + !NarrowestShift->getOperand(1)->hasOneUse()) return nullptr; } } |