r366683 - Updated the signature for some stack related intrinsics (CLANG)
Christudasan Devadasan via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 22 05:50:30 PDT 2019
Author: cdevadas
Date: Mon Jul 22 05:50:30 2019
New Revision: 366683
URL: http://llvm.org/viewvc/llvm-project?rev=366683&view=rev
Log:
Updated the signature for some stack related intrinsics (CLANG)
Modified the intrinsics
int_addressofreturnaddress,
int_frameaddress & int_sponentry.
This commit depends on the changes in rL366679
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D64563
Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/CodeGen/CGException.cpp
cfe/trunk/test/CodeGen/builtin-sponentry.c
cfe/trunk/test/CodeGen/exceptions-seh.c
cfe/trunk/test/CodeGen/integer-overflow.c
cfe/trunk/test/CodeGen/ms-intrinsics.c
cfe/trunk/test/CodeGen/ms-setjmp.c
cfe/trunk/test/CodeGenOpenCL/builtins-generic-amdgcn.cl
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=366683&r1=366682&r2=366683&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Jul 22 05:50:30 2019
@@ -843,10 +843,12 @@ static RValue EmitMSVCRTSetJmp(CodeGenFu
Name = SJKind == MSVCSetJmpKind::_setjmp ? "_setjmp" : "_setjmpex";
Arg1Ty = CGF.Int8PtrTy;
if (CGF.getTarget().getTriple().getArch() == llvm::Triple::aarch64) {
- Arg1 = CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(Intrinsic::sponentry));
+ Arg1 = CGF.Builder.CreateCall(
+ CGF.CGM.getIntrinsic(Intrinsic::sponentry, CGF.AllocaInt8PtrTy));
} else
- Arg1 = CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(Intrinsic::frameaddress),
- llvm::ConstantInt::get(CGF.Int32Ty, 0));
+ Arg1 = CGF.Builder.CreateCall(
+ CGF.CGM.getIntrinsic(Intrinsic::frameaddress, CGF.AllocaInt8PtrTy),
+ llvm::ConstantInt::get(CGF.Int32Ty, 0));
}
// Mark the call site and declaration with ReturnsTwice.
@@ -2556,7 +2558,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(
case Builtin::BI__builtin_frame_address: {
Value *Depth = ConstantEmitter(*this).emitAbstract(E->getArg(0),
getContext().UnsignedIntTy);
- Function *F = CGM.getIntrinsic(Intrinsic::frameaddress);
+ Function *F = CGM.getIntrinsic(Intrinsic::frameaddress, AllocaInt8PtrTy);
return RValue::get(Builder.CreateCall(F, Depth));
}
case Builtin::BI__builtin_extract_return_addr: {
@@ -2637,9 +2639,9 @@ RValue CodeGenFunction::EmitBuiltinExpr(
Address Buf = EmitPointerWithAlignment(E->getArg(0));
// Store the frame pointer to the setjmp buffer.
- Value *FrameAddr =
- Builder.CreateCall(CGM.getIntrinsic(Intrinsic::frameaddress),
- ConstantInt::get(Int32Ty, 0));
+ Value *FrameAddr = Builder.CreateCall(
+ CGM.getIntrinsic(Intrinsic::frameaddress, AllocaInt8PtrTy),
+ ConstantInt::get(Int32Ty, 0));
Builder.CreateStore(FrameAddr, Buf);
// Store the stack pointer to the setjmp buffer.
@@ -7293,12 +7295,13 @@ Value *CodeGenFunction::EmitAArch64Built
}
if (BuiltinID == AArch64::BI_AddressOfReturnAddress) {
- llvm::Function *F = CGM.getIntrinsic(Intrinsic::addressofreturnaddress);
+ llvm::Function *F =
+ CGM.getIntrinsic(Intrinsic::addressofreturnaddress, AllocaInt8PtrTy);
return Builder.CreateCall(F);
}
if (BuiltinID == AArch64::BI__builtin_sponentry) {
- llvm::Function *F = CGM.getIntrinsic(Intrinsic::sponentry);
+ llvm::Function *F = CGM.getIntrinsic(Intrinsic::sponentry, AllocaInt8PtrTy);
return Builder.CreateCall(F);
}
@@ -12113,7 +12116,8 @@ Value *CodeGenFunction::EmitX86BuiltinEx
}
case X86::BI_AddressOfReturnAddress: {
- Function *F = CGM.getIntrinsic(Intrinsic::addressofreturnaddress);
+ Function *F =
+ CGM.getIntrinsic(Intrinsic::addressofreturnaddress, AllocaInt8PtrTy);
return Builder.CreateCall(F);
}
case X86::BI__stosb: {
Modified: cfe/trunk/lib/CodeGen/CGException.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=366683&r1=366682&r2=366683&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGException.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGException.cpp Mon Jul 22 05:50:30 2019
@@ -1774,7 +1774,8 @@ void CodeGenFunction::EmitCapturedLocals
// EH registration is passed in as the EBP physical register. We can
// recover that with llvm.frameaddress(1).
EntryFP = Builder.CreateCall(
- CGM.getIntrinsic(llvm::Intrinsic::frameaddress), {Builder.getInt32(1)});
+ CGM.getIntrinsic(llvm::Intrinsic::frameaddress, AllocaInt8PtrTy),
+ {Builder.getInt32(1)});
} else {
// Otherwise, for x64 and 32-bit finally functions, the parent FP is the
// second parameter.
Modified: cfe/trunk/test/CodeGen/builtin-sponentry.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtin-sponentry.c?rev=366683&r1=366682&r2=366683&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtin-sponentry.c (original)
+++ cfe/trunk/test/CodeGen/builtin-sponentry.c Mon Jul 22 05:50:30 2019
@@ -4,5 +4,5 @@ void *test_sponentry() {
return __builtin_sponentry();
}
// CHECK-LABEL: define dso_local i8* @test_sponentry()
-// CHECK: = tail call i8* @llvm.sponentry()
+// CHECK: = tail call i8* @llvm.sponentry.p0i8()
// CHECK: ret i8*
Modified: cfe/trunk/test/CodeGen/exceptions-seh.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exceptions-seh.c?rev=366683&r1=366682&r2=366683&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/exceptions-seh.c (original)
+++ cfe/trunk/test/CodeGen/exceptions-seh.c Mon Jul 22 05:50:30 2019
@@ -51,7 +51,7 @@ int safe_div(int numerator, int denomina
// 32-bit SEH needs this filter to save the exception code.
//
// X86-LABEL: define internal i32 @"?filt$0 at 0@safe_div@@"()
-// X86: %[[ebp:[^ ]*]] = call i8* @llvm.frameaddress(i32 1)
+// X86: %[[ebp:[^ ]*]] = call i8* @llvm.frameaddress.p0i8(i32 1)
// X86: %[[fp:[^ ]*]] = call i8* @llvm.eh.recoverfp(i8* bitcast (i32 (i32, i32, i32*)* @safe_div to i8*), i8* %[[ebp]])
// X86: call i8* @llvm.localrecover(i8* bitcast (i32 (i32, i32, i32*)* @safe_div to i8*), i8* %[[fp]], i32 0)
// X86: load i8*, i8**
@@ -103,7 +103,7 @@ int filter_expr_capture(void) {
// ARM64: call i8* @llvm.localrecover(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %[[fp]], i32 0)
//
// X86-LABEL: define internal i32 @"?filt$0 at 0@filter_expr_capture@@"()
-// X86: %[[ebp:[^ ]*]] = call i8* @llvm.frameaddress(i32 1)
+// X86: %[[ebp:[^ ]*]] = call i8* @llvm.frameaddress.p0i8(i32 1)
// X86: %[[fp:[^ ]*]] = call i8* @llvm.eh.recoverfp(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %[[ebp]])
// X86: call i8* @llvm.localrecover(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %[[fp]], i32 0)
//
Modified: cfe/trunk/test/CodeGen/integer-overflow.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/integer-overflow.c?rev=366683&r1=366682&r2=366683&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/integer-overflow.c (original)
+++ cfe/trunk/test/CodeGen/integer-overflow.c Mon Jul 22 05:50:30 2019
@@ -99,8 +99,8 @@ void test1() {
// PR24256: don't instrument __builtin_frame_address.
__builtin_frame_address(0 + 0);
- // DEFAULT: call i8* @llvm.frameaddress(i32 0)
- // WRAPV: call i8* @llvm.frameaddress(i32 0)
- // TRAPV: call i8* @llvm.frameaddress(i32 0)
- // CATCH_UB: call i8* @llvm.frameaddress(i32 0)
+ // DEFAULT: call i8* @llvm.frameaddress.p0i8(i32 0)
+ // WRAPV: call i8* @llvm.frameaddress.p0i8(i32 0)
+ // TRAPV: call i8* @llvm.frameaddress.p0i8(i32 0)
+ // CATCH_UB: call i8* @llvm.frameaddress.p0i8(i32 0)
}
Modified: cfe/trunk/test/CodeGen/ms-intrinsics.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-intrinsics.c?rev=366683&r1=366682&r2=366683&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ms-intrinsics.c (original)
+++ cfe/trunk/test/CodeGen/ms-intrinsics.c Mon Jul 22 05:50:30 2019
@@ -142,7 +142,7 @@ void *test_AddressOfReturnAddress() {
return _AddressOfReturnAddress();
}
// CHECK-INTEL-LABEL: define dso_local i8* @test_AddressOfReturnAddress()
-// CHECK-INTEL: = tail call i8* @llvm.addressofreturnaddress()
+// CHECK-INTEL: = tail call i8* @llvm.addressofreturnaddress.p0i8()
// CHECK-INTEL: ret i8*
#endif
Modified: cfe/trunk/test/CodeGen/ms-setjmp.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-setjmp.c?rev=366683&r1=366682&r2=366683&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ms-setjmp.c (original)
+++ cfe/trunk/test/CodeGen/ms-setjmp.c Mon Jul 22 05:50:30 2019
@@ -20,12 +20,12 @@ int test_setjmp() {
// I386-NEXT: ret i32 %[[call]]
// X64-LABEL: define dso_local i32 @test_setjmp
- // X64: %[[addr:.*]] = call i8* @llvm.frameaddress(i32 0)
+ // X64: %[[addr:.*]] = call i8* @llvm.frameaddress.p0i8(i32 0)
// X64: %[[call:.*]] = call i32 @_setjmp(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @jb, i64 0, i64 0), i8* %[[addr]])
// X64-NEXT: ret i32 %[[call]]
// AARCH64-LABEL: define dso_local i32 @test_setjmp
- // AARCH64: %[[addr:.*]] = call i8* @llvm.sponentry()
+ // AARCH64: %[[addr:.*]] = call i8* @llvm.sponentry.p0i8()
// AARCH64: %[[call:.*]] = call i32 @_setjmpex(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @jb, i64 0, i64 0), i8* %[[addr]])
// AARCH64-NEXT: ret i32 %[[call]]
}
@@ -33,12 +33,12 @@ int test_setjmp() {
int test_setjmpex() {
return _setjmpex(jb);
// X64-LABEL: define dso_local i32 @test_setjmpex
- // X64: %[[addr:.*]] = call i8* @llvm.frameaddress(i32 0)
+ // X64: %[[addr:.*]] = call i8* @llvm.frameaddress.p0i8(i32 0)
// X64: %[[call:.*]] = call i32 @_setjmpex(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @jb, i64 0, i64 0), i8* %[[addr]])
// X64-NEXT: ret i32 %[[call]]
// AARCH64-LABEL: define dso_local i32 @test_setjmpex
- // AARCH64: %[[addr:.*]] = call i8* @llvm.sponentry()
+ // AARCH64: %[[addr:.*]] = call i8* @llvm.sponentry.p0i8()
// AARCH64: %[[call:.*]] = call i32 @_setjmpex(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @jb, i64 0, i64 0), i8* %[[addr]])
// AARCH64-NEXT: ret i32 %[[call]]
}
Modified: cfe/trunk/test/CodeGenOpenCL/builtins-generic-amdgcn.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/builtins-generic-amdgcn.cl?rev=366683&r1=366682&r2=366683&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenOpenCL/builtins-generic-amdgcn.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/builtins-generic-amdgcn.cl Mon Jul 22 05:50:30 2019
@@ -14,3 +14,8 @@ void test_builtin_clzl(global long* out,
{
*out = __builtin_clzl(a);
}
+
+// CHECK: tail call i8 addrspace(5)* @llvm.frameaddress.p5i8(i32 0)
+void test_builtin_frame_address(int *out) {
+ *out = __builtin_frame_address(0);
+}
More information about the cfe-commits
mailing list