Update clang for intrinsic rename of framerecover to localrecover

llvm-svn: 241634
This commit is contained in:
Reid Kleckner 2015-07-07 22:26:07 +00:00
parent 60381791b5
commit 98cb8ba64c
5 changed files with 26 additions and 26 deletions

View File

@ -1396,13 +1396,13 @@ llvm::Value *CodeGenFunction::recoverAddrOfEscapedLocal(
CGBuilderTy Builder(AllocaInsertPt); CGBuilderTy Builder(AllocaInsertPt);
if (auto *ParentAlloca = dyn_cast<llvm::AllocaInst>(ParentVar)) { if (auto *ParentAlloca = dyn_cast<llvm::AllocaInst>(ParentVar)) {
// Mark the variable escaped if nobody else referenced it and compute the // Mark the variable escaped if nobody else referenced it and compute the
// frameescape index. // localescape index.
auto InsertPair = ParentCGF.EscapedLocals.insert( auto InsertPair = ParentCGF.EscapedLocals.insert(
std::make_pair(ParentAlloca, ParentCGF.EscapedLocals.size())); std::make_pair(ParentAlloca, ParentCGF.EscapedLocals.size()));
int FrameEscapeIdx = InsertPair.first->second; int FrameEscapeIdx = InsertPair.first->second;
// call i8* @llvm.framerecover(i8* bitcast(@parentFn), i8* %fp, i32 N) // call i8* @llvm.localrecover(i8* bitcast(@parentFn), i8* %fp, i32 N)
llvm::Function *FrameRecoverFn = llvm::Intrinsic::getDeclaration( llvm::Function *FrameRecoverFn = llvm::Intrinsic::getDeclaration(
&CGM.getModule(), llvm::Intrinsic::framerecover); &CGM.getModule(), llvm::Intrinsic::localrecover);
llvm::Constant *ParentI8Fn = llvm::Constant *ParentI8Fn =
llvm::ConstantExpr::getBitCast(ParentCGF.CurFn, Int8PtrTy); llvm::ConstantExpr::getBitCast(ParentCGF.CurFn, Int8PtrTy);
RecoverCall = Builder.CreateCall( RecoverCall = Builder.CreateCall(
@ -1411,12 +1411,12 @@ llvm::Value *CodeGenFunction::recoverAddrOfEscapedLocal(
} else { } else {
// If the parent didn't have an alloca, we're doing some nested outlining. // If the parent didn't have an alloca, we're doing some nested outlining.
// Just clone the existing framerecover call, but tweak the FP argument to // Just clone the existing localrecover call, but tweak the FP argument to
// use our FP value. All other arguments are constants. // use our FP value. All other arguments are constants.
auto *ParentRecover = auto *ParentRecover =
cast<llvm::IntrinsicInst>(ParentVar->stripPointerCasts()); cast<llvm::IntrinsicInst>(ParentVar->stripPointerCasts());
assert(ParentRecover->getIntrinsicID() == llvm::Intrinsic::framerecover && assert(ParentRecover->getIntrinsicID() == llvm::Intrinsic::localrecover &&
"expected alloca or framerecover in parent LocalDeclMap"); "expected alloca or localrecover in parent LocalDeclMap");
RecoverCall = cast<llvm::CallInst>(ParentRecover->clone()); RecoverCall = cast<llvm::CallInst>(ParentRecover->clone());
RecoverCall->setArgOperand(1, ParentFP); RecoverCall->setArgOperand(1, ParentFP);
RecoverCall->insertBefore(AllocaInsertPt); RecoverCall->insertBefore(AllocaInsertPt);
@ -1468,7 +1468,7 @@ void CodeGenFunction::EmitCapturedLocals(CodeGenFunction &ParentCGF,
ParentFP = AI; ParentFP = AI;
} }
// Create llvm.framerecover calls for all captures. // Create llvm.localrecover calls for all captures.
for (const VarDecl *VD : Finder.Captures) { for (const VarDecl *VD : Finder.Captures) {
if (isa<ImplicitParamDecl>(VD)) { if (isa<ImplicitParamDecl>(VD)) {
CGM.ErrorUnsupported(VD, "'this' captured by SEH"); CGM.ErrorUnsupported(VD, "'this' captured by SEH");

View File

@ -284,7 +284,7 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) {
Builder.ClearInsertionPoint(); Builder.ClearInsertionPoint();
} }
// If some of our locals escaped, insert a call to llvm.frameescape in the // If some of our locals escaped, insert a call to llvm.localescape in the
// entry block. // entry block.
if (!EscapedLocals.empty()) { if (!EscapedLocals.empty()) {
// Invert the map from local to index into a simple vector. There should be // Invert the map from local to index into a simple vector. There should be
@ -294,7 +294,7 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) {
for (auto &Pair : EscapedLocals) for (auto &Pair : EscapedLocals)
EscapeArgs[Pair.second] = Pair.first; EscapeArgs[Pair.second] = Pair.first;
llvm::Function *FrameEscapeFn = llvm::Intrinsic::getDeclaration( llvm::Function *FrameEscapeFn = llvm::Intrinsic::getDeclaration(
&CGM.getModule(), llvm::Intrinsic::frameescape); &CGM.getModule(), llvm::Intrinsic::localescape);
CGBuilderTy(AllocaInsertPt).CreateCall(FrameEscapeFn, EscapeArgs); CGBuilderTy(AllocaInsertPt).CreateCall(FrameEscapeFn, EscapeArgs);
} }

View File

@ -888,7 +888,7 @@ private:
DeclMapTy LocalDeclMap; DeclMapTy LocalDeclMap;
/// Track escaped local variables with auto storage. Used during SEH /// Track escaped local variables with auto storage. Used during SEH
/// outlining to produce a call to llvm.frameescape. /// outlining to produce a call to llvm.localescape.
llvm::DenseMap<llvm::AllocaInst *, int> EscapedLocals; llvm::DenseMap<llvm::AllocaInst *, int> EscapedLocals;
/// LabelMap - This keeps track of the LLVM basic block for each C label. /// LabelMap - This keeps track of the LLVM basic block for each C label.
@ -2068,13 +2068,13 @@ public:
/// Scan the outlined statement for captures from the parent function. For /// Scan the outlined statement for captures from the parent function. For
/// each capture, mark the capture as escaped and emit a call to /// each capture, mark the capture as escaped and emit a call to
/// llvm.framerecover. Insert the framerecover result into the LocalDeclMap. /// llvm.localrecover. Insert the localrecover result into the LocalDeclMap.
void EmitCapturedLocals(CodeGenFunction &ParentCGF, const Stmt *OutlinedStmt, void EmitCapturedLocals(CodeGenFunction &ParentCGF, const Stmt *OutlinedStmt,
bool IsFilter); bool IsFilter);
/// Recovers the address of a local in a parent function. ParentVar is the /// Recovers the address of a local in a parent function. ParentVar is the
/// address of the variable used in the immediate parent function. It can /// address of the variable used in the immediate parent function. It can
/// either be an alloca or a call to llvm.framerecover if there are nested /// either be an alloca or a call to llvm.localrecover if there are nested
/// outlined functions. ParentFP is the frame pointer of the outermost parent /// outlined functions. ParentFP is the frame pointer of the outermost parent
/// frame. /// frame.
llvm::Value *recoverAddrOfEscapedLocal(CodeGenFunction &ParentCGF, llvm::Value *recoverAddrOfEscapedLocal(CodeGenFunction &ParentCGF,

View File

@ -57,7 +57,7 @@ int safe_div(int numerator, int denominator, int *res) {
// X86-LABEL: define internal i32 @"\01?filt$0@0@safe_div@@"() // X86-LABEL: define internal i32 @"\01?filt$0@0@safe_div@@"()
// X86: %[[ebp:[^ ]*]] = call i8* @llvm.frameaddress(i32 1) // X86: %[[ebp:[^ ]*]] = call i8* @llvm.frameaddress(i32 1)
// X86: %[[fp:[^ ]*]] = call i8* @llvm.x86.seh.recoverfp(i8* bitcast (i32 (i32, i32, i32*)* @safe_div to i8*), i8* %[[ebp]]) // X86: %[[fp:[^ ]*]] = call i8* @llvm.x86.seh.recoverfp(i8* bitcast (i32 (i32, i32, i32*)* @safe_div to i8*), i8* %[[ebp]])
// X86: call i8* @llvm.framerecover(i8* bitcast (i32 (i32, i32, i32*)* @safe_div to i8*), i8* %[[fp]], i32 0) // X86: call i8* @llvm.localrecover(i8* bitcast (i32 (i32, i32, i32*)* @safe_div to i8*), i8* %[[fp]], i32 0)
// X86: load i8*, i8** // X86: load i8*, i8**
// X86: load i32*, i32** // X86: load i32*, i32**
// X86: load i32, i32* // X86: load i32, i32*
@ -79,8 +79,8 @@ int filter_expr_capture(void) {
// CHECK-LABEL: define i32 @filter_expr_capture() // CHECK-LABEL: define i32 @filter_expr_capture()
// X64-SAME: personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) // X64-SAME: personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*)
// X86-SAME: personality i8* bitcast (i32 (...)* @_except_handler3 to i8*) // X86-SAME: personality i8* bitcast (i32 (...)* @_except_handler3 to i8*)
// X64: call void (...) @llvm.frameescape(i32* %[[r:[^ ,]*]]) // X64: call void (...) @llvm.localescape(i32* %[[r:[^ ,]*]])
// X86: call void (...) @llvm.frameescape(i32* %[[r:[^ ,]*]], i32* %[[code:[^ ,]*]]) // X86: call void (...) @llvm.localescape(i32* %[[r:[^ ,]*]], i32* %[[code:[^ ,]*]])
// CHECK: store i32 42, i32* %[[r]] // CHECK: store i32 42, i32* %[[r]]
// CHECK: invoke void @j() #[[NOINLINE]] // CHECK: invoke void @j() #[[NOINLINE]]
// //
@ -92,12 +92,12 @@ int filter_expr_capture(void) {
// CHECK: ret i32 %[[rv]] // CHECK: ret i32 %[[rv]]
// X64-LABEL: define internal i32 @"\01?filt$0@0@filter_expr_capture@@"(i8* %exception_pointers, i8* %frame_pointer) // X64-LABEL: define internal i32 @"\01?filt$0@0@filter_expr_capture@@"(i8* %exception_pointers, i8* %frame_pointer)
// X64: call i8* @llvm.framerecover(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %frame_pointer, i32 0) // X64: call i8* @llvm.localrecover(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %frame_pointer, i32 0)
// //
// X86-LABEL: define internal i32 @"\01?filt$0@0@filter_expr_capture@@"() // X86-LABEL: define internal i32 @"\01?filt$0@0@filter_expr_capture@@"()
// X86: %[[ebp:[^ ]*]] = call i8* @llvm.frameaddress(i32 1) // X86: %[[ebp:[^ ]*]] = call i8* @llvm.frameaddress(i32 1)
// X86: %[[fp:[^ ]*]] = call i8* @llvm.x86.seh.recoverfp(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %[[ebp]]) // X86: %[[fp:[^ ]*]] = call i8* @llvm.x86.seh.recoverfp(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %[[ebp]])
// X86: call i8* @llvm.framerecover(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %[[fp]], i32 0) // X86: call i8* @llvm.localrecover(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %[[fp]], i32 0)
// //
// CHECK: store i32 -1, i32* %{{.*}} // CHECK: store i32 -1, i32* %{{.*}}
// CHECK: ret i32 -1 // CHECK: ret i32 -1
@ -181,7 +181,7 @@ int basic_finally(int g) {
// X64-SAME: personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) // X64-SAME: personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*)
// X86-SAME: personality i8* bitcast (i32 (...)* @_except_handler3 to i8*) // X86-SAME: personality i8* bitcast (i32 (...)* @_except_handler3 to i8*)
// CHECK: %[[g_addr:[^ ]*]] = alloca i32, align 4 // CHECK: %[[g_addr:[^ ]*]] = alloca i32, align 4
// CHECK: call void (...) @llvm.frameescape(i32* %[[g_addr]]) // CHECK: call void (...) @llvm.localescape(i32* %[[g_addr]])
// CHECK: store i32 %g, i32* %[[g_addr]] // CHECK: store i32 %g, i32* %[[g_addr]]
// //
// CHECK: invoke void @j() // CHECK: invoke void @j()
@ -201,7 +201,7 @@ int basic_finally(int g) {
// CHECK: resume // CHECK: resume
// CHECK: define internal void @"\01?fin$0@0@basic_finally@@"({{i8( zeroext)?}} %abnormal_termination, i8* %frame_pointer) // CHECK: define internal void @"\01?fin$0@0@basic_finally@@"({{i8( zeroext)?}} %abnormal_termination, i8* %frame_pointer)
// CHECK: call i8* @llvm.framerecover(i8* bitcast (i32 (i32)* @basic_finally to i8*), i8* %frame_pointer, i32 0) // CHECK: call i8* @llvm.localrecover(i8* bitcast (i32 (i32)* @basic_finally to i8*), i8* %frame_pointer, i32 0)
// CHECK: load i32, i32* %{{.*}}, align 4 // CHECK: load i32, i32* %{{.*}}, align 4
// CHECK: add nsw i32 %{{.*}}, 1 // CHECK: add nsw i32 %{{.*}}, 1
// CHECK: store i32 %{{.*}}, i32* %{{.*}}, align 4 // CHECK: store i32 %{{.*}}, i32* %{{.*}}, align 4

View File

@ -15,15 +15,15 @@ extern "C" void test_freefunc(int p1) {
} }
// CHECK-LABEL: define void @test_freefunc(i32 %p1) // CHECK-LABEL: define void @test_freefunc(i32 %p1)
// CHECK: @llvm.frameescape(i32* %[[p1_ptr:[^, ]*]], i32* %[[l1_ptr:[^, ]*]]) // CHECK: @llvm.localescape(i32* %[[p1_ptr:[^, ]*]], i32* %[[l1_ptr:[^, ]*]])
// CHECK: store i32 %p1, i32* %[[p1_ptr]], align 4 // CHECK: store i32 %p1, i32* %[[p1_ptr]], align 4
// CHECK: store i32 13, i32* %[[l1_ptr]], align 4 // CHECK: store i32 13, i32* %[[l1_ptr]], align 4
// CHECK: invoke void @might_crash() // CHECK: invoke void @might_crash()
// CHECK-LABEL: define internal i32 @"\01?filt$0@0@test_freefunc@@"(i8* %exception_pointers, i8* %frame_pointer) // CHECK-LABEL: define internal i32 @"\01?filt$0@0@test_freefunc@@"(i8* %exception_pointers, i8* %frame_pointer)
// CHECK: %[[p1_i8:[^ ]*]] = call i8* @llvm.framerecover(i8* bitcast (void (i32)* @test_freefunc to i8*), i8* %frame_pointer, i32 0) // CHECK: %[[p1_i8:[^ ]*]] = call i8* @llvm.localrecover(i8* bitcast (void (i32)* @test_freefunc to i8*), i8* %frame_pointer, i32 0)
// CHECK: %[[p1_ptr:[^ ]*]] = bitcast i8* %[[p1_i8]] to i32* // CHECK: %[[p1_ptr:[^ ]*]] = bitcast i8* %[[p1_i8]] to i32*
// CHECK: %[[l1_i8:[^ ]*]] = call i8* @llvm.framerecover(i8* bitcast (void (i32)* @test_freefunc to i8*), i8* %frame_pointer, i32 1) // CHECK: %[[l1_i8:[^ ]*]] = call i8* @llvm.localrecover(i8* bitcast (void (i32)* @test_freefunc to i8*), i8* %frame_pointer, i32 1)
// CHECK: %[[l1_ptr:[^ ]*]] = bitcast i8* %[[l1_i8]] to i32* // CHECK: %[[l1_ptr:[^ ]*]] = bitcast i8* %[[l1_i8]] to i32*
// CHECK: %[[s1:[^ ]*]] = load i32, i32* @"\01?s1@?1??test_freefunc@@9@4HA", align 4 // CHECK: %[[s1:[^ ]*]] = load i32, i32* @"\01?s1@?1??test_freefunc@@9@4HA", align 4
// CHECK: %[[l1:[^ ]*]] = load i32, i32* %[[l1_ptr]] // CHECK: %[[l1:[^ ]*]] = load i32, i32* %[[l1_ptr]]
@ -45,12 +45,12 @@ void S::test_method() {
} }
// CHECK-LABEL: define void @"\01?test_method@S@@QEAAXXZ"(%struct.S* %this) // CHECK-LABEL: define void @"\01?test_method@S@@QEAAXXZ"(%struct.S* %this)
// CHECK: @llvm.frameescape(i32* %[[l1_addr:[^, ]*]]) // CHECK: @llvm.localescape(i32* %[[l1_addr:[^, ]*]])
// CHECK: store i32 13, i32* %[[l1_addr]], align 4 // CHECK: store i32 13, i32* %[[l1_addr]], align 4
// CHECK: invoke void @might_crash() // CHECK: invoke void @might_crash()
// CHECK-LABEL: define internal i32 @"\01?filt$0@0@test_method@S@@"(i8* %exception_pointers, i8* %frame_pointer) // CHECK-LABEL: define internal i32 @"\01?filt$0@0@test_method@S@@"(i8* %exception_pointers, i8* %frame_pointer)
// CHECK: %[[l1_i8:[^ ]*]] = call i8* @llvm.framerecover(i8* bitcast (void (%struct.S*)* @"\01?test_method@S@@QEAAXXZ" to i8*), i8* %frame_pointer, i32 0) // CHECK: %[[l1_i8:[^ ]*]] = call i8* @llvm.localrecover(i8* bitcast (void (%struct.S*)* @"\01?test_method@S@@QEAAXXZ" to i8*), i8* %frame_pointer, i32 0)
// CHECK: %[[l1_ptr:[^ ]*]] = bitcast i8* %[[l1_i8]] to i32* // CHECK: %[[l1_ptr:[^ ]*]] = bitcast i8* %[[l1_i8]] to i32*
// CHECK: %[[l1:[^ ]*]] = load i32, i32* %[[l1_ptr]] // CHECK: %[[l1:[^ ]*]] = load i32, i32* %[[l1_ptr]]
// CHECK: call i32 (i32, ...) @basic_filter(i32 %[[l1]]) // CHECK: call i32 (i32, ...) @basic_filter(i32 %[[l1]])
@ -69,12 +69,12 @@ void test_lambda() {
} }
// CHECK-LABEL: define internal void @"\01??R<lambda_0>@?test_lambda@@YAXXZ@QEBAXXZ"(%class.anon* %this) // CHECK-LABEL: define internal void @"\01??R<lambda_0>@?test_lambda@@YAXXZ@QEBAXXZ"(%class.anon* %this)
// CHECK: @llvm.frameescape(i32* %[[l2_addr:[^, ]*]]) // CHECK: @llvm.localescape(i32* %[[l2_addr:[^, ]*]])
// CHECK: store i32 42, i32* %[[l2_addr]], align 4 // CHECK: store i32 42, i32* %[[l2_addr]], align 4
// CHECK: invoke void @might_crash() // CHECK: invoke void @might_crash()
// CHECK-LABEL: define internal i32 @"\01?filt$0@0@?R<lambda_0>@?test_lambda@@YAXXZ@"(i8* %exception_pointers, i8* %frame_pointer) // CHECK-LABEL: define internal i32 @"\01?filt$0@0@?R<lambda_0>@?test_lambda@@YAXXZ@"(i8* %exception_pointers, i8* %frame_pointer)
// CHECK: %[[l2_i8:[^ ]*]] = call i8* @llvm.framerecover(i8* bitcast (void (%class.anon*)* @"\01??R<lambda_0>@?test_lambda@@YAXXZ@QEBAXXZ" to i8*), i8* %frame_pointer, i32 0) // CHECK: %[[l2_i8:[^ ]*]] = call i8* @llvm.localrecover(i8* bitcast (void (%class.anon*)* @"\01??R<lambda_0>@?test_lambda@@YAXXZ@QEBAXXZ" to i8*), i8* %frame_pointer, i32 0)
// CHECK: %[[l2_ptr:[^ ]*]] = bitcast i8* %[[l2_i8]] to i32* // CHECK: %[[l2_ptr:[^ ]*]] = bitcast i8* %[[l2_i8]] to i32*
// CHECK: %[[l2:[^ ]*]] = load i32, i32* %[[l2_ptr]] // CHECK: %[[l2:[^ ]*]] = load i32, i32* %[[l2_ptr]]
// CHECK: call i32 (i32, ...) @basic_filter(i32 %[[l2]]) // CHECK: call i32 (i32, ...) @basic_filter(i32 %[[l2]])