@@ -263,12 +263,7 @@ static llvm::FunctionCallee getPersonalityFn(CodeGenModule &CGM,
263
263
static llvm::Constant *getOpaquePersonalityFn (CodeGenModule &CGM,
264
264
const EHPersonality &Personality) {
265
265
llvm::FunctionCallee Fn = getPersonalityFn (CGM, Personality);
266
- llvm::PointerType* Int8PtrTy = llvm::PointerType::get (
267
- llvm::Type::getInt8Ty (CGM.getLLVMContext ()),
268
- CGM.getDataLayout ().getProgramAddressSpace ());
269
-
270
- return llvm::ConstantExpr::getBitCast (cast<llvm::Constant>(Fn.getCallee ()),
271
- Int8PtrTy);
266
+ return cast<llvm::Constant>(Fn.getCallee ());
272
267
}
273
268
274
269
// / Check whether a landingpad instruction only uses C++ features.
@@ -1838,13 +1833,11 @@ Address CodeGenFunction::recoverAddrOfEscapedLocal(CodeGenFunction &ParentCGF,
1838
1833
auto InsertPair = ParentCGF.EscapedLocals .insert (
1839
1834
std::make_pair (ParentAlloca, ParentCGF.EscapedLocals .size ()));
1840
1835
int FrameEscapeIdx = InsertPair.first ->second ;
1841
- // call i8* @llvm.localrecover(i8* bitcast( @parentFn), i8* %fp, i32 N)
1836
+ // call ptr @llvm.localrecover(ptr @parentFn, ptr %fp, i32 N)
1842
1837
llvm::Function *FrameRecoverFn = llvm::Intrinsic::getDeclaration (
1843
1838
&CGM.getModule (), llvm::Intrinsic::localrecover);
1844
- llvm::Constant *ParentI8Fn =
1845
- llvm::ConstantExpr::getBitCast (ParentCGF.CurFn , Int8PtrTy);
1846
1839
RecoverCall = Builder.CreateCall (
1847
- FrameRecoverFn, {ParentI8Fn , ParentFP,
1840
+ FrameRecoverFn, {ParentCGF. CurFn , ParentFP,
1848
1841
llvm::ConstantInt::get (Int32Ty, FrameEscapeIdx)});
1849
1842
1850
1843
} else {
@@ -1907,9 +1900,7 @@ void CodeGenFunction::EmitCapturedLocals(CodeGenFunction &ParentCGF,
1907
1900
// since finally funclets recover the parent FP for us.
1908
1901
llvm::Function *RecoverFPIntrin =
1909
1902
CGM.getIntrinsic (llvm::Intrinsic::eh_recoverfp);
1910
- llvm::Constant *ParentI8Fn =
1911
- llvm::ConstantExpr::getBitCast (ParentCGF.CurFn , Int8PtrTy);
1912
- ParentFP = Builder.CreateCall (RecoverFPIntrin, {ParentI8Fn, EntryFP});
1903
+ ParentFP = Builder.CreateCall (RecoverFPIntrin, {ParentCGF.CurFn , EntryFP});
1913
1904
1914
1905
// if the parent is a _finally, the passed-in ParentFP is the FP
1915
1906
// of parent _finally, not Establisher's FP (FP of outermost function).
@@ -1937,19 +1928,15 @@ void CodeGenFunction::EmitCapturedLocals(CodeGenFunction &ParentCGF,
1937
1928
int FrameEscapeIdx = InsertPair.first ->second ;
1938
1929
1939
1930
// an example of a filter's prolog::
1940
- // %0 = call i8* @llvm.eh.recoverfp(bitcast(@"?fin$0@0@main@@"),..)
1941
- // %1 = call i8* @llvm.localrecover(bitcast(@"?fin$0@0@main@@"),..)
1942
- // %2 = bitcast i8* %1 to i8**
1943
- // %3 = load i8*, i8* *%2, align 8
1944
- // ==> %3 is the frame-pointer of outermost host function
1931
+ // %0 = call ptr @llvm.eh.recoverfp(@"?fin$0@0@main@@",..)
1932
+ // %1 = call ptr @llvm.localrecover(@"?fin$0@0@main@@",..)
1933
+ // %2 = load ptr, ptr %1, align 8
1934
+ // ==> %2 is the frame-pointer of outermost host function
1945
1935
llvm::Function *FrameRecoverFn = llvm::Intrinsic::getDeclaration (
1946
1936
&CGM.getModule (), llvm::Intrinsic::localrecover);
1947
- llvm::Constant *ParentI8Fn =
1948
- llvm::ConstantExpr::getBitCast (ParentCGF.CurFn , Int8PtrTy);
1949
1937
ParentFP = Builder.CreateCall (
1950
- FrameRecoverFn, {ParentI8Fn , ParentFP,
1938
+ FrameRecoverFn, {ParentCGF. CurFn , ParentFP,
1951
1939
llvm::ConstantInt::get (Int32Ty, FrameEscapeIdx)});
1952
- ParentFP = Builder.CreateBitCast (ParentFP, CGM.VoidPtrPtrTy );
1953
1940
ParentFP = Builder.CreateLoad (
1954
1941
Address (ParentFP, CGM.VoidPtrTy , getPointerAlign ()));
1955
1942
}
@@ -2206,9 +2193,7 @@ void CodeGenFunction::EnterSEHTryStmt(const SEHTryStmt &S) {
2206
2193
// in place of the RTTI typeinfo global that C++ EH uses.
2207
2194
llvm::Function *FilterFunc =
2208
2195
HelperCGF.GenerateSEHFilterFunction (*this , *Except);
2209
- llvm::Constant *OpaqueFunc =
2210
- llvm::ConstantExpr::getBitCast (FilterFunc, Int8PtrTy);
2211
- CatchScope->setHandler (0 , OpaqueFunc, createBasicBlock (" __except.ret" ));
2196
+ CatchScope->setHandler (0 , FilterFunc, createBasicBlock (" __except.ret" ));
2212
2197
}
2213
2198
2214
2199
void CodeGenFunction::ExitSEHTryStmt (const SEHTryStmt &S) {
0 commit comments