-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The symptom is that an assertion is triggered. The assertion was added by me to detect the situation when value is propagated from dead blocks. (We can certainly get rid of assertion; it is safe to do so, because propagating value from dead block to alive join node is certainly ok.) The root cause of this bug is : edge-splitting is conducted on the fly, the edge being split could be a dead edge, therefore the block that split the critial edge needs to be flagged "dead" as well. There are 3 ways to fix this bug: 1) Get rid of the assertion as I mentioned eariler 2) When an dead edge is split, flag the inserted block "dead". 3) proactively split the critical edges connecting dead and live blocks when new dead blocks are revealed. This fix go for 3) with additional 2 LOC. Testing case was added by Rafael the other day. llvm-svn: 194424
- Loading branch information
Shuxin Yang
committed
Nov 11, 2013
1 parent
8f1caeb
commit 3168ab3
Showing
9 changed files
with
396 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
; RUN: opt -basicaa -gvn -S < %s | FileCheck %s | ||
@y = external global i32 | ||
@z = external global i32 | ||
|
||
; Function Attrs: nounwind ssp uwtable | ||
define void @foo(i32 %x) { | ||
; CHECK: @foo(i32 %x) | ||
; CHECK: %.pre = load i32* @y | ||
; CHECK: call void @bar(i32 %.pre) | ||
|
||
%t = sub i32 %x, %x | ||
%.pre = load i32* @y, align 4 | ||
%cmp = icmp sgt i32 %t, 2 | ||
br i1 %cmp, label %if.then, label %entry.if.end_crit_edge | ||
|
||
entry.if.end_crit_edge: ; preds = %entry | ||
br label %if.end | ||
|
||
if.then: ; preds = %entry | ||
%add = add nsw i32 %x, 3 | ||
store i32 %add, i32* @y, align 4 | ||
br label %if.end | ||
|
||
if.end: ; preds = %entry.if.end_crit_edge, %if.then | ||
%1 = phi i32 [ %.pre, %entry.if.end_crit_edge ], [ %add, %if.then ] | ||
tail call void @bar(i32 %1) | ||
ret void | ||
} | ||
|
||
define void @foo2(i32 %x) { | ||
; CHECK: @foo2(i32 %x) | ||
; CHECK: %.pre = load i32* @y | ||
; CHECK: tail call void @bar(i32 %.pre) | ||
entry: | ||
%t = sub i32 %x, %x | ||
%.pre = load i32* @y, align 4 | ||
%cmp = icmp sgt i32 %t, 2 | ||
br i1 %cmp, label %if.then, label %if.else | ||
|
||
if.then: ; preds = %entry | ||
%add = add nsw i32 %x, 3 | ||
store i32 %add, i32* @y, align 4 | ||
br label %if.end | ||
|
||
if.else: ; preds = %entry | ||
store i32 1, i32* @z, align 4 | ||
br label %if.end | ||
|
||
if.end: ; preds = %if.else, %if.then | ||
%0 = phi i32 [ %.pre, %if.else ], [ %add, %if.then ] | ||
tail call void @bar(i32 %0) | ||
ret void | ||
} | ||
|
||
declare void @bar(i32) |
Oops, something went wrong.