-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #951: false-positive condition for loop sinks doesn't take nonret…
…urn functions into account
- Loading branch information
1 parent
756f799
commit 6381cd9
Showing
2 changed files
with
39 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
; ERROR: Source is more defined than target | ||
; TEST-ARGS: -src-unroll=3 -tgt-unroll=3 | ||
|
||
define i8 @src(i8 %v) { | ||
entry: | ||
%v.nonneg = icmp sgt i8 %v, -1 | ||
br label %for.body | ||
|
||
for.body: | ||
%sum = phi i8 [ 0, %entry ], [ %sum.next, %for.body ] | ||
%sum.next = add i8 %sum, %v | ||
%overflow = icmp ult i8 %sum.next, %sum | ||
%cmp.i5.i = xor i1 %v.nonneg, %overflow | ||
call void @use(i1 %cmp.i5.i) | ||
br i1 %cmp.i5.i, label %for.body, label %cleanup1.loopexit | ||
|
||
cleanup1.loopexit: | ||
%cmp.not.lcssa.ph = phi i8 [ %sum, %for.body ] | ||
ret i8 %cmp.not.lcssa.ph | ||
} | ||
|
||
define i8 @tgt(i8 %v) { | ||
entry: | ||
%v.nonneg = icmp sgt i8 %v, -1 | ||
br label %for.body | ||
|
||
for.body: | ||
%sum = phi i8 [ 0, %entry ], [ %sum.next, %for.body ] | ||
%sum.next = add i8 %sum, %v | ||
call void @use(i1 %v.nonneg) | ||
br i1 %v.nonneg, label %for.body, label %cleanup1.loopexit | ||
|
||
cleanup1.loopexit: | ||
%cmp.not.lcssa.ph = phi i8 [ %sum, %for.body ] | ||
ret i8 %cmp.not.lcssa.ph | ||
} | ||
|
||
declare void @use(i1) |