[PATCH] D64275: [InstCombine] Generalize InstCombiner::foldAndOrOfICmpsOfAndWithPow2().

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 11:12:30 PDT 2019


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:908-910
+        B = Builder.CreateLShr(
+            ConstantInt::get(Ty, APInt::getSignMask(Ty->getScalarSizeInBits())),
+            B2);
----------------
spatel wrote:
> lebedev.ri wrote:
> > To be pointed out, this indeed creates an instruction while we don't know yet whether we will be able to do the fold,
> > not great, but i think this is the smallest evil, the alternative solution would indeed be uglier..
> Hmm...do we have a test where the temporary instruction is created, but the fold fails?
> Last time I made that mistake, we infinite looped: the temporary instruction gets created and deleted triggering another round of combining and repeat forever.
Oh, hmm.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D64275





More information about the llvm-commits mailing list