r300290 - Revert r300287.
Kuba Mracek via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 13 18:00:03 PDT 2017
Author: kuba.brecka
Date: Thu Apr 13 20:00:03 2017
New Revision: 300290
URL: http://llvm.org/viewvc/llvm-project?rev=300290&view=rev
Log:
Revert r300287.
Modified:
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/test/CodeGenObjC/arc-foreach.m
cfe/trunk/test/CodeGenObjC/arc-ternary-op.m
Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=300290&r1=300289&r2=300290&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Thu Apr 13 20:00:03 2017
@@ -1469,6 +1469,11 @@ void CodeGenFunction::EmitObjCForCollect
if (DI)
DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin());
+ // The local variable comes into scope immediately.
+ AutoVarEmission variable = AutoVarEmission::invalid();
+ if (const DeclStmt *SD = dyn_cast<DeclStmt>(S.getElement()))
+ variable = EmitAutoVarAlloca(*cast<VarDecl>(SD->getSingleDecl()));
+
JumpDest LoopEnd = getJumpDestInCurrentScope("forcoll.end");
// Fast enumeration state.
@@ -1620,10 +1625,8 @@ void CodeGenFunction::EmitObjCForCollect
bool elementIsVariable;
LValue elementLValue;
QualType elementType;
- AutoVarEmission variable = AutoVarEmission::invalid();
if (const DeclStmt *SD = dyn_cast<DeclStmt>(S.getElement())) {
// Initialize the variable, in case it's a __block variable or something.
- variable = EmitAutoVarAlloca(*cast<VarDecl>(SD->getSingleDecl()));
EmitAutoVarInit(variable);
const VarDecl* D = cast<VarDecl>(SD->getSingleDecl());
Modified: cfe/trunk/test/CodeGenObjC/arc-foreach.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-foreach.m?rev=300290&r1=300289&r2=300290&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/arc-foreach.m (original)
+++ cfe/trunk/test/CodeGenObjC/arc-foreach.m Thu Apr 13 20:00:03 2017
@@ -24,9 +24,9 @@ void test0(NSArray *array) {
// CHECK-LP64-LABEL: define void @test0(
// CHECK-LP64: [[ARRAY:%.*]] = alloca [[ARRAY_T:%.*]]*,
+// CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*,
// CHECK-LP64-NEXT: [[STATE:%.*]] = alloca [[STATE_T:%.*]],
// CHECK-LP64-NEXT: [[BUFFER:%.*]] = alloca [16 x i8*], align 8
-// CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*,
// CHECK-LP64-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]],
// Initialize 'array'.
@@ -97,9 +97,9 @@ void test1(NSArray *array) {
// CHECK-LP64-LABEL: define void @test1(
// CHECK-LP64: alloca [[ARRAY_T:%.*]]*,
+// CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*,
// CHECK-LP64-NEXT: [[STATE:%.*]] = alloca [[STATE_T:%.*]],
// CHECK-LP64-NEXT: alloca [16 x i8*], align 8
-// CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*,
// CHECK-LP64-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]],
// CHECK-LP64: [[T0:%.*]] = getelementptr inbounds [[STATE_T]], [[STATE_T]]* [[STATE]], i32 0, i32 1
@@ -160,7 +160,7 @@ void test3(NSArray *array) {
// CHECK-LP64-LABEL: define void @test3(
// CHECK-LP64: [[ARRAY:%.*]] = alloca [[ARRAY_T]]*, align 8
- // CHECK-LP64: [[X:%.*]] = alloca i8*, align 8
+ // CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*, align 8
// CHECK-LP64: [[T0:%.*]] = load i8*, i8** [[X]], align 8
// CHECK-LP64-NEXT: [[T1:%.*]] = icmp ne i8* [[T0]], null
// CHECK-LP64-NEXT: br i1 [[T1]],
Modified: cfe/trunk/test/CodeGenObjC/arc-ternary-op.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-ternary-op.m?rev=300290&r1=300289&r2=300290&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/arc-ternary-op.m (original)
+++ cfe/trunk/test/CodeGenObjC/arc-ternary-op.m Thu Apr 13 20:00:03 2017
@@ -120,9 +120,9 @@ void test2(int cond) {
// CHECK-LABEL: define void @test2(
// CHECK: [[COND:%.*]] = alloca i32,
+ // CHECK: alloca i8*
// CHECK: [[CLEANUP_SAVE:%.*]] = alloca i8*
// CHECK: [[RUN_CLEANUP:%.*]] = alloca i1
- // CHECK: alloca i8*
// Evaluate condition; cleanup disabled by default.
// CHECK: [[T0:%.*]] = load i32, i32* [[COND]],
// CHECK-NEXT: icmp ne i32 [[T0]], 0
More information about the cfe-commits
mailing list