[PATCH] D63812: [InstCombine] Shift amount reassociation (PR42391)
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 29 04:16:38 PDT 2019
nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: lib/Transforms/InstCombine/InstCombineShifts.cpp:37
+ return nullptr;
+ auto *Sh1 = cast<BinaryOperator>(Sh1Value);
+
----------------
Personally I'd prefer `auto *Sh1 = cast<BinaryOperator>(Sh0->getOperand(0))` over the use of `m_CombineAnd()` here, which makes the match less straightforward.
================
Comment at: lib/Transforms/InstCombine/InstCombineShifts.cpp:41
+ Instruction::BinaryOps ShiftOpcode = Sh0->getOpcode();
+ if (ShiftOpcode != cast<Instruction>(Sh0->getOperand(0))->getOpcode())
+ return nullptr;
----------------
Can replace `cast<Instruction>(Sh0->getOperand(0))` with `Sh1` here.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63812/new/
https://reviews.llvm.org/D63812
More information about the llvm-commits
mailing list