summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-08-14 03:41:33 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-08-14 03:41:33 +0000
commitae13df60a69d93374c39c3457ba4b493da2ffc65 (patch)
tree9b32df2937719376924ea14971b54c20a92cad71 /llvm/test/Transforms/InstCombine
parentde49278c2655bd5a52f1d8b6b23c737e56fcc3a1 (diff)
downloadbcm5719-llvm-ae13df60a69d93374c39c3457ba4b493da2ffc65.tar.gz
bcm5719-llvm-ae13df60a69d93374c39c3457ba4b493da2ffc65.zip
Don't attempt to add 'nsw' when intermediate instructions had no such guarantee.
llvm-svn: 137572
Diffstat (limited to 'llvm/test/Transforms/InstCombine')
-rw-r--r--llvm/test/Transforms/InstCombine/nsw.ll30
1 files changed, 29 insertions, 1 deletions
diff --git a/llvm/test/Transforms/InstCombine/nsw.ll b/llvm/test/Transforms/InstCombine/nsw.ll
index 698296384ae..0e715075fc3 100644
--- a/llvm/test/Transforms/InstCombine/nsw.ll
+++ b/llvm/test/Transforms/InstCombine/nsw.ll
@@ -46,10 +46,38 @@ define i32 @preserve1(i32 %x) nounwind {
ret i32 %add3
}
+; CHECK: @preserve2
+; CHECK: add nsw i8 %A, %B
+; CHECK: add nsw i8
+define i8 @preserve2(i8 %A, i8 %B) nounwind {
+ %x = add nsw i8 %A, 10
+ %y = add nsw i8 %B, 10
+ %add = add nsw i8 %x, %y
+ ret i8 %add
+}
+
; CHECK: @nopreserve1
; CHECK: add i8 %x, -126
define i8 @nopreserve1(i8 %x) nounwind {
%add = add nsw i8 %x, 127
%add3 = add nsw i8 %add, 3
ret i8 %add3
-} \ No newline at end of file
+}
+
+; CHECK: @nopreserve2
+; CHECK: add i8 %x, 3
+define i8 @nopreserve2(i8 %x) nounwind {
+ %add = add i8 %x, 1
+ %add3 = add nsw i8 %add, 2
+ ret i8 %add3
+}
+
+; CHECK: @nopreserve3
+; CHECK: add i8 %A, %B
+; CHECK: add i8
+define i8 @nopreserve3(i8 %A, i8 %B) nounwind {
+ %x = add i8 %A, 10
+ %y = add i8 %B, 10
+ %add = add nsw i8 %x, %y
+ ret i8 %add
+}
OpenPOWER on IntegriCloud