aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/AutoUpgrade.cpp
diff options
context:
space:
mode:
authorShilei Tian <i@tianshilei.me>2025-05-15 10:03:20 -0400
committerGitHub <noreply@github.com>2025-05-15 10:03:20 -0400
commit7314d38b72ea647c67ceab0de4755d2d61073dac (patch)
treec1e36153309fff86e7b54b8dfe1f7b7bf3dbf110 /llvm/lib/IR/AutoUpgrade.cpp
parent6ee30e8dd8810f6ce49095a30a2caae683d92ff5 (diff)
downloadllvm-7314d38b72ea647c67ceab0de4755d2d61073dac.zip
llvm-7314d38b72ea647c67ceab0de4755d2d61073dac.tar.gz
llvm-7314d38b72ea647c67ceab0de4755d2d61073dac.tar.bz2
[NFC][AutoUpgrade] Use `ConstantPointerNull::get` instead of `Constant::getNullValue` for known pointer types (#139984)
This is a preparation change for upcoming PRs that will update the semantics of `ConstantPointerNull`, making it to represent an actual `nullptr` rather than a zero-valued pointer.
Diffstat (limited to 'llvm/lib/IR/AutoUpgrade.cpp')
-rw-r--r--llvm/lib/IR/AutoUpgrade.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 9091e75..41aa06a 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -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()));
}
Constant *NewInit = ConstantArray::get(ArrayType::get(EltTy, N), NewCtors);
@@ -4721,10 +4721,10 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
}
// Create a new call with an added null annotation attribute argument.
- NewCall =
- Builder.CreateCall(NewFn, {CI->getArgOperand(0), CI->getArgOperand(1),
- CI->getArgOperand(2), CI->getArgOperand(3),
- Constant::getNullValue(Builder.getPtrTy())});
+ NewCall = Builder.CreateCall(
+ NewFn,
+ {CI->getArgOperand(0), CI->getArgOperand(1), CI->getArgOperand(2),
+ CI->getArgOperand(3), ConstantPointerNull::get(Builder.getPtrTy())});
NewCall->takeName(CI);
CI->replaceAllUsesWith(NewCall);
CI->eraseFromParent();
@@ -4737,10 +4737,10 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
return;
}
// Create a new call with an added null annotation attribute argument.
- NewCall =
- Builder.CreateCall(NewFn, {CI->getArgOperand(0), CI->getArgOperand(1),
- CI->getArgOperand(2), CI->getArgOperand(3),
- Constant::getNullValue(Builder.getPtrTy())});
+ NewCall = Builder.CreateCall(
+ NewFn,
+ {CI->getArgOperand(0), CI->getArgOperand(1), CI->getArgOperand(2),
+ CI->getArgOperand(3), ConstantPointerNull::get(Builder.getPtrTy())});
NewCall->takeName(CI);
CI->replaceAllUsesWith(NewCall);
CI->eraseFromParent();