[llvm-branch-commits] [cfe-branch] r276656 - Merging r276361:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jul 25 10:19:20 PDT 2016
Author: hans
Date: Mon Jul 25 12:19:19 2016
New Revision: 276656
URL: http://llvm.org/viewvc/llvm-project?rev=276656&view=rev
Log:
Merging r276361:
------------------------------------------------------------------------
r276361 | wolfgangp | 2016-07-21 16:28:18 -0700 (Thu, 21 Jul 2016) | 5 lines
Reverting r275115 which caused PR28634.
When empty (forwarding) basic blocks that are referenced by user labels
are removed, incorrect code may be generated.
------------------------------------------------------------------------
Removed:
cfe/branches/release_39/test/CodeGen/forwarding-blocks-if.c
Modified:
cfe/branches/release_39/ (props changed)
cfe/branches/release_39/lib/CodeGen/CGStmt.cpp
Propchange: cfe/branches/release_39/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jul 25 12:19:19 2016
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:275880,275967
+/cfe/trunk:275880,275967,276361
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_39/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/CodeGen/CGStmt.cpp?rev=276656&r1=276655&r2=276656&view=diff
==============================================================================
--- cfe/branches/release_39/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/branches/release_39/lib/CodeGen/CGStmt.cpp Mon Jul 25 12:19:19 2016
@@ -620,14 +620,7 @@ void CodeGenFunction::EmitIfStmt(const I
RunCleanupsScope ThenScope(*this);
EmitStmt(S.getThen());
}
- {
- auto CurBlock = Builder.GetInsertBlock();
- EmitBranch(ContBlock);
- // Eliminate any empty blocks that may have been created by nested
- // control flow statements in the 'then' clause.
- if (CurBlock)
- SimplifyForwardingBlocks(CurBlock);
- }
+ EmitBranch(ContBlock);
// Emit the 'else' code if present.
if (const Stmt *Else = S.getElse()) {
@@ -643,12 +636,7 @@ void CodeGenFunction::EmitIfStmt(const I
{
// There is no need to emit line number for an unconditional branch.
auto NL = ApplyDebugLocation::CreateEmpty(*this);
- auto CurBlock = Builder.GetInsertBlock();
EmitBranch(ContBlock);
- // Eliminate any empty blocks that may have been created by nested
- // control flow statements emitted in the 'else' clause.
- if (CurBlock)
- SimplifyForwardingBlocks(CurBlock);
}
}
Removed: cfe/branches/release_39/test/CodeGen/forwarding-blocks-if.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/CodeGen/forwarding-blocks-if.c?rev=276655&view=auto
==============================================================================
--- cfe/branches/release_39/test/CodeGen/forwarding-blocks-if.c (original)
+++ cfe/branches/release_39/test/CodeGen/forwarding-blocks-if.c (removed)
@@ -1,36 +0,0 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
-// Check that no empty blocks are generated for nested ifs.
-
-extern void func();
-
-int f0(int val) {
- if (val == 0) {
- func();
- } else if (val == 1) {
- func();
- }
- return 0;
-}
-
-// CHECK-LABEL: define {{.*}}i32 @f0
-// CHECK: call void {{.*}} @func
-// CHECK: call void {{.*}} @func
-// CHECK: br label %[[RETBLOCK1:[^ ]*]]
-// CHECK: [[RETBLOCK1]]:
-// CHECK-NOT: br label
-// CHECK: ret i32
-
-int f1(int val, int g) {
- if (val == 0)
- if (g == 1) {
- func();
- }
- return 0;
-}
-
-// CHECK-LABEL: define {{.*}}i32 @f1
-// CHECK: call void {{.*}} @func
-// CHECK: br label %[[RETBLOCK2:[^ ]*]]
-// CHECK: [[RETBLOCK2]]:
-// CHECK-NOT: br label
-// CHECK: ret i32
More information about the llvm-branch-commits
mailing list