Index: include/llvm/IR/Intrinsics.td =================================================================== --- include/llvm/IR/Intrinsics.td +++ include/llvm/IR/Intrinsics.td @@ -404,9 +404,9 @@ //===--------------------- Code Generator Intrinsics ----------------------===// // def int_returnaddress : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty], [IntrNoMem, ImmArg<0>]>; -def int_addressofreturnaddress : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>; -def int_frameaddress : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty], [IntrNoMem, ImmArg<0>]>; -def int_sponentry : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>; +def int_addressofreturnaddress : Intrinsic<[llvm_anyptr_ty], [], [IntrNoMem]>; +def int_frameaddress : Intrinsic<[llvm_anyptr_ty], [llvm_i32_ty], [IntrNoMem, ImmArg<0>]>; +def int_sponentry : Intrinsic<[llvm_anyptr_ty], [], [IntrNoMem]>; def int_read_register : Intrinsic<[llvm_anyint_ty], [llvm_metadata_ty], [IntrReadMem], "llvm.read_register">; def int_write_register : Intrinsic<[], [llvm_metadata_ty, llvm_anyint_ty], Index: lib/CodeGen/SjLjEHPrepare.cpp =================================================================== --- lib/CodeGen/SjLjEHPrepare.cpp +++ lib/CodeGen/SjLjEHPrepare.cpp @@ -477,7 +477,8 @@ UnregisterFn = M.getOrInsertFunction( "_Unwind_SjLj_Unregister", Type::getVoidTy(M.getContext()), PointerType::getUnqual(FunctionContextTy)); - FrameAddrFn = Intrinsic::getDeclaration(&M, Intrinsic::frameaddress); + FrameAddrFn = Intrinsic::getDeclaration(&M, Intrinsic::frameaddress, + {Type::getInt8PtrTy(M.getContext())}); StackAddrFn = Intrinsic::getDeclaration(&M, Intrinsic::stacksave); StackRestoreFn = Intrinsic::getDeclaration(&M, Intrinsic::stackrestore); BuiltinSetupDispatchFn = Index: lib/Target/X86/X86WinEHState.cpp =================================================================== --- lib/Target/X86/X86WinEHState.cpp +++ lib/Target/X86/X86WinEHState.cpp @@ -339,7 +339,8 @@ if (UseStackGuard) { Value *Val = Builder.CreateLoad(Int32Ty, Cookie); Value *FrameAddr = Builder.CreateCall( - Intrinsic::getDeclaration(TheModule, Intrinsic::frameaddress), + Intrinsic::getDeclaration(TheModule, Intrinsic::frameaddress, + Builder.getInt8PtrTy()), Builder.getInt32(0), "frameaddr"); Value *FrameAddrI32 = Builder.CreatePtrToInt(FrameAddr, Int32Ty); FrameAddrI32 = Builder.CreateXor(FrameAddrI32, Val); Index: lib/Transforms/Instrumentation/HWAddressSanitizer.cpp =================================================================== --- lib/Transforms/Instrumentation/HWAddressSanitizer.cpp +++ lib/Transforms/Instrumentation/HWAddressSanitizer.cpp @@ -766,7 +766,7 @@ // first). Module *M = IRB.GetInsertBlock()->getParent()->getParent(); auto GetStackPointerFn = - Intrinsic::getDeclaration(M, Intrinsic::frameaddress); + Intrinsic::getDeclaration(M, Intrinsic::frameaddress, Int8PtrTy); Value *StackPointer = IRB.CreateCall( GetStackPointerFn, {Constant::getNullValue(IRB.getInt32Ty())}); @@ -899,8 +899,8 @@ PC = readRegister(IRB, "pc"); else PC = IRB.CreatePtrToInt(F, IntptrTy); - auto GetStackPointerFn = - Intrinsic::getDeclaration(F->getParent(), Intrinsic::frameaddress); + auto GetStackPointerFn = Intrinsic::getDeclaration( + F->getParent(), Intrinsic::frameaddress, Int8PtrTy); Value *SP = IRB.CreatePtrToInt( IRB.CreateCall(GetStackPointerFn, {Constant::getNullValue(IRB.getInt32Ty())}), Index: lib/Transforms/Instrumentation/SanitizerCoverage.cpp =================================================================== --- lib/Transforms/Instrumentation/SanitizerCoverage.cpp +++ lib/Transforms/Instrumentation/SanitizerCoverage.cpp @@ -842,8 +842,8 @@ } if (Options.StackDepth && IsEntryBB && !IsLeafFunc) { // Check stack depth. If it's the deepest so far, record it. - Function *GetFrameAddr = - Intrinsic::getDeclaration(F.getParent(), Intrinsic::frameaddress); + Function *GetFrameAddr = Intrinsic::getDeclaration( + F.getParent(), Intrinsic::frameaddress, Int8PtrTy); auto FrameAddrPtr = IRB.CreateCall(GetFrameAddr, {Constant::getNullValue(Int32Ty)}); auto FrameAddrInt = IRB.CreatePtrToInt(FrameAddrPtr, IntptrTy); Index: test/Bitcode/compatibility-3.6.ll =================================================================== --- test/Bitcode/compatibility-3.6.ll +++ test/Bitcode/compatibility-3.6.ll @@ -1116,7 +1116,7 @@ call i8* @llvm.returnaddress(i32 1) ; CHECK: call i8* @llvm.returnaddress(i32 1) call i8* @llvm.frameaddress(i32 1) - ; CHECK: call i8* @llvm.frameaddress(i32 1) + ; CHECK: call i8* @llvm.frameaddress.p0i8(i32 1) call i32 @llvm.read_register.i32(metadata !10) ; CHECK: call i32 @llvm.read_register.i32(metadata !10) Index: test/Bitcode/compatibility-3.7.ll =================================================================== --- test/Bitcode/compatibility-3.7.ll +++ test/Bitcode/compatibility-3.7.ll @@ -1147,7 +1147,7 @@ call i8* @llvm.returnaddress(i32 1) ; CHECK: call i8* @llvm.returnaddress(i32 1) call i8* @llvm.frameaddress(i32 1) - ; CHECK: call i8* @llvm.frameaddress(i32 1) + ; CHECK: call i8* @llvm.frameaddress.p0i8(i32 1) call i32 @llvm.read_register.i32(metadata !10) ; CHECK: call i32 @llvm.read_register.i32(metadata !10) Index: test/Bitcode/compatibility-3.8.ll =================================================================== --- test/Bitcode/compatibility-3.8.ll +++ test/Bitcode/compatibility-3.8.ll @@ -1302,7 +1302,7 @@ call i8* @llvm.returnaddress(i32 1) ; CHECK: call i8* @llvm.returnaddress(i32 1) call i8* @llvm.frameaddress(i32 1) - ; CHECK: call i8* @llvm.frameaddress(i32 1) + ; CHECK: call i8* @llvm.frameaddress.p0i8(i32 1) call i32 @llvm.read_register.i32(metadata !10) ; CHECK: call i32 @llvm.read_register.i32(metadata !10) Index: test/Bitcode/compatibility-3.9.ll =================================================================== --- test/Bitcode/compatibility-3.9.ll +++ test/Bitcode/compatibility-3.9.ll @@ -1373,7 +1373,7 @@ call i8* @llvm.returnaddress(i32 1) ; CHECK: call i8* @llvm.returnaddress(i32 1) call i8* @llvm.frameaddress(i32 1) - ; CHECK: call i8* @llvm.frameaddress(i32 1) + ; CHECK: call i8* @llvm.frameaddress.p0i8(i32 1) call i32 @llvm.read_register.i32(metadata !10) ; CHECK: call i32 @llvm.read_register.i32(metadata !10) Index: test/Bitcode/compatibility-4.0.ll =================================================================== --- test/Bitcode/compatibility-4.0.ll +++ test/Bitcode/compatibility-4.0.ll @@ -1373,7 +1373,7 @@ call i8* @llvm.returnaddress(i32 1) ; CHECK: call i8* @llvm.returnaddress(i32 1) call i8* @llvm.frameaddress(i32 1) - ; CHECK: call i8* @llvm.frameaddress(i32 1) + ; CHECK: call i8* @llvm.frameaddress.p0i8(i32 1) call i32 @llvm.read_register.i32(metadata !10) ; CHECK: call i32 @llvm.read_register.i32(metadata !10) Index: test/Bitcode/compatibility-5.0.ll =================================================================== --- test/Bitcode/compatibility-5.0.ll +++ test/Bitcode/compatibility-5.0.ll @@ -1383,7 +1383,7 @@ call i8* @llvm.returnaddress(i32 1) ; CHECK: call i8* @llvm.returnaddress(i32 1) call i8* @llvm.frameaddress(i32 1) - ; CHECK: call i8* @llvm.frameaddress(i32 1) + ; CHECK: call i8* @llvm.frameaddress.p0i8(i32 1) call i32 @llvm.read_register.i32(metadata !10) ; CHECK: call i32 @llvm.read_register.i32(metadata !10) Index: test/Bitcode/compatibility-6.0.ll =================================================================== --- test/Bitcode/compatibility-6.0.ll +++ test/Bitcode/compatibility-6.0.ll @@ -1394,7 +1394,7 @@ call i8* @llvm.returnaddress(i32 1) ; CHECK: call i8* @llvm.returnaddress(i32 1) call i8* @llvm.frameaddress(i32 1) - ; CHECK: call i8* @llvm.frameaddress(i32 1) + ; CHECK: call i8* @llvm.frameaddress.p0i8(i32 1) call i32 @llvm.read_register.i32(metadata !10) ; CHECK: call i32 @llvm.read_register.i32(metadata !10) Index: test/Bitcode/compatibility.ll =================================================================== --- test/Bitcode/compatibility.ll +++ test/Bitcode/compatibility.ll @@ -1486,7 +1486,7 @@ call i8* @llvm.returnaddress(i32 1) ; CHECK: call i8* @llvm.returnaddress(i32 1) call i8* @llvm.frameaddress(i32 1) - ; CHECK: call i8* @llvm.frameaddress(i32 1) + ; CHECK: call i8* @llvm.frameaddress.p0i8(i32 1) call i32 @llvm.read_register.i32(metadata !10) ; CHECK: call i32 @llvm.read_register.i32(metadata !10) Index: test/Instrumentation/HWAddressSanitizer/alloca.ll =================================================================== --- test/Instrumentation/HWAddressSanitizer/alloca.ll +++ test/Instrumentation/HWAddressSanitizer/alloca.ll @@ -11,7 +11,7 @@ define void @test_alloca() sanitize_hwaddress { ; CHECK-LABEL: @test_alloca( -; CHECK: %[[FP:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +; CHECK: %[[FP:[^ ]*]] = call i8* @llvm.frameaddress.p0i8(i32 0) ; CHECK: %[[A:[^ ]*]] = ptrtoint i8* %[[FP]] to i64 ; CHECK: %[[B:[^ ]*]] = lshr i64 %[[A]], 20 ; CHECK: %[[BASE_TAG:[^ ]*]] = xor i64 %[[A]], %[[B]] Index: test/Instrumentation/HWAddressSanitizer/kernel-alloca.ll =================================================================== --- test/Instrumentation/HWAddressSanitizer/kernel-alloca.ll +++ test/Instrumentation/HWAddressSanitizer/kernel-alloca.ll @@ -9,7 +9,7 @@ define void @test_alloca() sanitize_hwaddress { ; CHECK-LABEL: @test_alloca( -; CHECK: %[[FP:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +; CHECK: %[[FP:[^ ]*]] = call i8* @llvm.frameaddress.p0i8(i32 0) ; CHECK: %[[A:[^ ]*]] = ptrtoint i8* %[[FP]] to i64 ; CHECK: %[[B:[^ ]*]] = lshr i64 %[[A]], 20 ; CHECK: %[[BASE_TAG:[^ ]*]] = xor i64 %[[A]], %[[B]] Index: test/Instrumentation/SanitizerCoverage/stack-depth.ll =================================================================== --- test/Instrumentation/SanitizerCoverage/stack-depth.ll +++ test/Instrumentation/SanitizerCoverage/stack-depth.ll @@ -14,7 +14,7 @@ define i32 @foo() { entry: ; CHECK-LABEL: define i32 @foo -; CHECK-NOT: call i8* @llvm.frameaddress(i32 0) +; CHECK-NOT: call i8* @llvm.frameaddress.p0i8(i32 0) ; CHECK-NOT: @__sancov_lowest_stack ; CHECK: ret i32 7 @@ -24,7 +24,7 @@ define i32 @bar() { entry: ; CHECK-LABEL: define i32 @bar -; CHECK: [[framePtr:%[^ \t]+]] = call i8* @llvm.frameaddress(i32 0) +; CHECK: [[framePtr:%[^ \t]+]] = call i8* @llvm.frameaddress.p0i8(i32 0) ; CHECK: [[frameInt:%[^ \t]+]] = ptrtoint i8* [[framePtr]] to [[intType:i[0-9]+]] ; CHECK: [[lowest:%[^ \t]+]] = load [[intType]], [[intType]]* @__sancov_lowest_stack ; CHECK: [[cmp:%[^ \t]+]] = icmp ult [[intType]] [[frameInt]], [[lowest]] Index: test/Verifier/intrinsic-immarg.ll =================================================================== --- test/Verifier/intrinsic-immarg.ll +++ test/Verifier/intrinsic-immarg.ll @@ -13,7 +13,7 @@ define void @frame_address(i32 %var) { ; CHECK: immarg operand has non-immediate parameter ; CHECK-NEXT: i32 %var - ; CHECK-NEXT: %result = call i8* @llvm.frameaddress(i32 %var) + ; CHECK-NEXT: %result = call i8* @llvm.frameaddress.p0i8(i32 %var) %result = call i8* @llvm.frameaddress(i32 %var) ret void }