[llvm] [SimplifyCFG] Handle vector GEP in `passingValueIsAlwaysUndefined` (PR #142526)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 3 04:48:03 PDT 2025


================
@@ -8177,6 +8178,10 @@ static bool passingValueIsAlwaysUndefined(Value *V, Instruction *I, bool PtrValu
              NullPointerIsDefined(GEP->getFunction(),
                                   GEP->getPointerAddressSpace())))
           PtrValueMayBeModified = true;
+        // The type of GEP may differ from the type of base pointer.
+        if (V->getType() != GEP->getType())
+          V = ConstantVector::getSplat(
+              cast<VectorType>(GEP->getType())->getElementCount(), C);
----------------
dtcxzyw wrote:

I mean `llvm.masked.gather(<n x ptr> zeroinitializer,,splat(i1 true),)` is also UB.


https://github.com/llvm/llvm-project/pull/142526


More information about the llvm-commits mailing list