[PATCH] D39222: [InstCombine] Pull shifts through a select plus binop with constant
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 6 09:29:07 PST 2017
spatel added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstCombineShifts.cpp:318-320
+ bool isValid = true; // Valid only for And, Or Xor,
+ bool highBitSet = false; // Transform ifhigh bit of constant set?
+
----------------
Since we're moving this, we might as well fix the formatting - capitalize variables.
================
Comment at: lib/Transforms/InstCombine/InstCombineShifts.cpp:539-544
+ if (auto *SI = dyn_cast<SelectInst>(Op0)) {
+ Value *TrueVal = SI->getTrueValue();
+ Value *FalseVal = SI->getFalseValue();
+
+ if (auto *TVI = dyn_cast<BinaryOperator>(TrueVal)) {
+ if (TVI->hasOneUse() && !isa<Constant>(FalseVal)) {
----------------
Use matchers to reduce the number of if-checks and indenting?
CmpInst::Predicate P;
BinaryOperator *TVI;
Value *FalseVal;
if (match(Op0, m_Select(P, m_OneUse(m_BinOp(TVI)), m_Value(FalseVal))) ...
https://reviews.llvm.org/D39222
More information about the llvm-commits
mailing list