[llvm] [VN] be more consistent about forwarding null inputs and ignoring SVE outputs (PR #139574)

Jameson Nash via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 13:42:24 PDT 2025


================
@@ -317,6 +321,13 @@ static Value *getStoreValueForLoadHelper(Value *SrcVal, unsigned Offset,
                                          Type *LoadTy, IRBuilderBase &Builder,
                                          const DataLayout &DL) {
   LLVMContext &Ctx = SrcVal->getType()->getContext();
+  // If CI is a null value, the intermediate code formed later might be invalid
+  // (e.g. creating a ptrtoint on NI addrspace), since it is a special case in
+  // canCoerceMustAliasedValueToLoad, so instead form the NullValue for the load
+  // directly
+  if (auto *CI = dyn_cast<Constant>(getUnderlyingObject(SrcVal)))
----------------
vtjnash wrote:

Huh, yeah, I cannot think of a reason, and it is wrong to be there (If the SrcVal was some GEP offset from NULL, that can result in a non-NULL value, which shouldn't take this shortcut here)

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


More information about the llvm-commits mailing list