Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The bug was a result of getPreStartForExtend interpreting nsw/nuw flags on an add recurrence more strongly than is legal. {S,+,X}<nsw> implies S+X is nsw only if the backedge of the loop is taken at least once. Differential Revision: http://reviews.llvm.org/D7808 llvm-svn: 230275
- Loading branch information
Showing
9 changed files
with
69 additions
and
10 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
30 changes: 30 additions & 0 deletions
30
llvm/test/Analysis/ScalarEvolution/scev-expander-incorrect-nowrap.ll
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,30 @@ | ||
; RUN: opt -indvars -S < %s | FileCheck %s | ||
|
||
declare void @use(i32) | ||
declare void @use.i8(i8) | ||
|
||
define void @f() { | ||
; CHECK-LABEL: @f | ||
entry: | ||
br label %loop | ||
|
||
loop: | ||
; The only use for idx.mirror is to induce an nuw for %idx. It does | ||
; not induce an nuw for %idx.inc | ||
%idx.mirror = phi i8 [ -6, %entry ], [ %idx.mirror.inc, %loop ] | ||
%idx = phi i8 [ -5, %entry ], [ %idx.inc, %loop ] | ||
|
||
%idx.sext = sext i8 %idx to i32 | ||
call void @use(i32 %idx.sext) | ||
|
||
%idx.mirror.inc = add nuw i8 %idx.mirror, 1 | ||
call void @use.i8(i8 %idx.mirror.inc) | ||
|
||
%idx.inc = add i8 %idx, 1 | ||
; CHECK-NOT: %indvars.iv.next = add nuw nsw i32 %indvars.iv, 1 | ||
%cmp = icmp ugt i8 %idx.inc, 0 | ||
br i1 %cmp, label %loop, label %exit | ||
|
||
exit: | ||
ret void | ||
} |
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
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