aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/AutoUpgrade.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-02-08 16:50:11 +0100
committerNikita Popov <npopov@redhat.com>2022-02-08 16:52:05 +0100
commit48eeefe59f2d2ab44eb771e8ae315cd15f97f57b (patch)
tree001d921f183563df2a12624fc721d6c9b50b02b2 /llvm/lib/IR/AutoUpgrade.cpp
parenteabae1b0175691d1f979299b22a25ed4474864a0 (diff)
downloadllvm-48eeefe59f2d2ab44eb771e8ae315cd15f97f57b.zip
llvm-48eeefe59f2d2ab44eb771e8ae315cd15f97f57b.tar.gz
llvm-48eeefe59f2d2ab44eb771e8ae315cd15f97f57b.tar.bz2
[AutoUpgrade] Handle remangling upgrade for ptr.annotation
The code assumed that the upgrade would happen due to the argument count changing from 4 to 5. However, a remangling upgrade is also possible here.
Diffstat (limited to 'llvm/lib/IR/AutoUpgrade.cpp')
-rw-r--r--llvm/lib/IR/AutoUpgrade.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 8102e17..6803fdb 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -3886,8 +3886,11 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
case Intrinsic::ptr_annotation:
// Upgrade from versions that lacked the annotation attribute argument.
- assert(CI->arg_size() == 4 &&
- "Before LLVM 12.0 this intrinsic took four arguments");
+ if (CI->arg_size() != 4) {
+ DefaultCase();
+ return;
+ }
+
// Create a new call with an added null annotation attribute argument.
NewCall = Builder.CreateCall(
NewFn,