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

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 17:02:07 PDT 2016


mkuper added inline comments.

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

================
Comment at: lib/Analysis/ConstantFolding.cpp:1862
@@ +1861,3 @@
+      auto *MaskElt =
+          dyn_cast_or_null<ConstantInt>(Mask->getAggregateElement(I));
+      if (!MaskElt)
----------------
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?



http://reviews.llvm.org/D22324





More information about the llvm-commits mailing list