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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 13:56:38 PST 2020


lebedev.ri added a comment.

(This is in a need of a bit of rebase once i'm ready to post the final patch to actually rewrite the loop into countable.)



================
Comment at: llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:2059
+                      m_Value(CurrX),
+                      m_PHI(m_Incoming(m_SpecificBB(LoopPreheaderBB),
+                                       m_Value(BaseX)),
----------------
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..


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