Skip to content

Commit

Permalink
Reverting r275115 which caused PR28634.
Browse files Browse the repository at this point in the history
When empty (forwarding) basic blocks that are referenced by user labels
are removed, incorrect code may be generated.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@276361 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
wolfy1961 committed Jul 21, 2016
1 parent acca0b5 commit 4c0ade3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 49 deletions.
14 changes: 1 addition & 13 deletions lib/CodeGen/CGStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,14 +623,7 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
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()) {
Expand All @@ -646,12 +639,7 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
{
// 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);
}
}

Expand Down
36 changes: 0 additions & 36 deletions test/CodeGen/forwarding-blocks-if.c

This file was deleted.

0 comments on commit 4c0ade3

Please sign in to comment.