forked from OSchip/llvm-project
[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.
This commit is contained in:
parent
eabae1b017
commit
48eeefe59f
|
@ -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,
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -opaque-pointers < %s | FileCheck %s
|
||||
|
||||
; Make sure that an intrinsic remangling upgrade works for invokes as well.
|
||||
; Make sure that opaque pointer intrinsic remangling upgrade works.
|
||||
|
||||
declare i32* @fake_personality_function()
|
||||
declare void @func()
|
||||
|
||||
; Upgrading of invoked intrinsic.
|
||||
define void @test_invoke(i32 addrspace(1)* %b) gc "statepoint-example" personality i32* ()* @fake_personality_function {
|
||||
; CHECK-LABEL: @test_invoke(
|
||||
; CHECK-NEXT: entry:
|
||||
|
@ -33,4 +34,14 @@ unwind_dest:
|
|||
ret void
|
||||
}
|
||||
|
||||
define i8* @test_ptr_annotation(i8* %p) {
|
||||
; CHECK-LABEL: @test_ptr_annotation(
|
||||
; CHECK-NEXT: [[P2:%.*]] = call ptr @llvm.ptr.annotation.p0(ptr [[P:%.*]], ptr undef, ptr undef, i32 undef, ptr undef)
|
||||
; CHECK-NEXT: ret ptr [[P2]]
|
||||
;
|
||||
%p2 = call i8* @llvm.ptr.annotation.p0i8(i8* %p, i8* undef, i8* undef, i32 undef, i8* undef)
|
||||
ret i8* %p2
|
||||
}
|
||||
|
||||
declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)
|
||||
declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32, i8*)
|
Loading…
Reference in New Issue