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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 11:03:31 PDT 2019


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:908-910
+        B = Builder.CreateLShr(
+            ConstantInt::get(Ty, APInt::getSignMask(Ty->getScalarSizeInBits())),
+            B2);
----------------
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.


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