[PATCH] D91038: [LoopIdiom] Introduce 'left-shift until bittest' idiom

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 15 00:32:01 PST 2020


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:2166
+      XMaskedNumActiveBits, Constant::getAllOnesValue(BitMask->getType()),
+      XMasked->getName() + ".numleadingonepos");
+
----------------
craig.topper wrote:
> This is called ".leadingonepos" in the comment block.
Argh, i was sure i fixed that already :)


================
Comment at: llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:2059
+                      m_Value(CurrX),
+                      m_PHI(m_Incoming(m_SpecificBB(LoopPreheaderBB),
+                                       m_Value(BaseX)),
----------------
lebedev.ri wrote:
> craig.topper wrote:
> > Why are we adding a whole new matcher infrastructure for phis? Why can't we use getIncomingValueForBlock?
> There is no particular reason other than that
> `m_c_And(m_Value(), m_Constant())`
> is preferred to
> `I.getOpcode() == Instruction::And && (isa<Constant>I.getOperand(0) || isa<Constant>I.getOperand(1))`,
> because it's just that much more readable.
> Of course, i can use old good methodology..
On a second look, let's drop it for now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91038/new/

https://reviews.llvm.org/D91038



More information about the llvm-commits mailing list