[PATCH] D22324: Move a transform from InstCombine to InstSimplify.

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 17:09:55 PDT 2016


majnemer added inline comments.

================
Comment at: lib/Analysis/ConstantFolding.cpp:1857
@@ +1856,3 @@
+    auto *Passthru = Operands[3];
+    Constant *VecData = ConstantFoldLoadFromConstPtr(SrcPtr, VTy, DL);
+
----------------
mkuper wrote:
> Missing null check?
Ah, good catch.

================
Comment at: lib/Analysis/ConstantFolding.cpp:1862
@@ +1861,3 @@
+      auto *MaskElt =
+          dyn_cast_or_null<ConstantInt>(Mask->getAggregateElement(I));
+      if (!MaskElt)
----------------
mkuper wrote:
> I think this can return an undef - in which case you'll bail, when you don't necessarily have to. Although undef masks are probably rare, so it doesn't matter that much.
> Also, do we have a helper to check that the mask is a constant/undef? If so, maybe call that before entering the loop for an early exit?
> 
I think undef masks could be handled later. We already know that `Mask` is a `Constant *` because `Operands` is an `ArrayRef` of `Constant *`.


http://reviews.llvm.org/D22324





More information about the llvm-commits mailing list