1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
llvm-mirror/test/Analysis/ScalarEvolution/pr22641.ll
Sanjoy Das 5b35fffa29 Fix bug 22641
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.

NOTE: I had accidentally committed an unrelated change with the commit
message of this change in r230275 (r230275 was reverted in r230279).
This is the correct change for this commit message.

Differential Revision: http://reviews.llvm.org/D7808

llvm-svn: 230291
2015-02-24 01:02:42 +00:00

26 lines
606 B
LLVM

; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s
define i1 @main(i16 %a) {
; CHECK-LABEL: Classifying expressions for: @main
entry:
br label %body
body:
%dec2 = phi i16 [ %a, %entry ], [ %dec, %cond ]
%dec = add i16 %dec2, -1
%conv2 = zext i16 %dec2 to i32
%conv = zext i16 %dec to i32
; CHECK: %conv = zext i16 %dec to i32
; CHECK-NEXT: --> {(zext i16 (-1 + %a) to i32),+,65535}<nuw><%body>
; CHECK-NOT: --> {(65535 + (zext i16 %a to i32)),+,65535}<nuw><%body>
br label %cond
cond:
br i1 false, label %body, label %exit
exit:
%ret = icmp ne i32 %conv, 0
ret i1 %ret
}