[llvm] [NFC][AutoUpgrade] Use `ConstantPointerNull::get` instead of `Constant::getNullValue` for known pointer types (PR #139984)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu May 15 00:02:45 PDT 2025


================
@@ -1613,7 +1613,7 @@ GlobalVariable *llvm::UpgradeGlobalVariable(GlobalVariable *GV) {
     auto Ctor = cast<Constant>(Init->getOperand(i));
     NewCtors[i] = ConstantStruct::get(EltTy, Ctor->getAggregateElement(0u),
                                       Ctor->getAggregateElement(1),
-                                      Constant::getNullValue(IRB.getPtrTy()));
+                                      ConstantPointerNull::get(IRB.getPtrTy()));
----------------
arsenm wrote:

There's a preexisting bug here. It's not using the type of this value, which may not be addrspace(0)

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


More information about the llvm-commits mailing list