aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/overflow.ll
diff options
context:
space:
mode:
authorMark Seaborn <mseaborn@chromium.org>2013-05-28 18:53:14 -0700
committerMark Seaborn <mseaborn@chromium.org>2013-05-28 18:53:14 -0700
commit8d01804c97533ed9006a65c11cade3c6b23d1c75 (patch)
treec073a4ad687e373698cdbe5d3c3735ba39c18b1a /test/Transforms/InstCombine/overflow.ll
parent75e093a353d4a6420fed47fb46fb7134a922ec61 (diff)
PNaCl: Disable parts of InstCombine that introduce *.with.overflow intrinsics
Change the PNaCl ABI checker to disallow these intrinsics. Note that I had originally intended to commit this before my earlier change (https://codereview.chromium.org/15688011) that enables the ExpandArithWithOverflow pass. Enabling ExpandArithWithOverflow without changing InstCombine causes ExpandArithWithOverflow to fail on some of the *.with.overflow intrinsic calls that InstCombine introduces. This change therefore fixes some breakage. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3434 TEST=PNaCl toolchain trybots + GCC torture tests + LLVM test suite Review URL: https://codereview.chromium.org/16042011
Diffstat (limited to 'test/Transforms/InstCombine/overflow.ll')
-rw-r--r--test/Transforms/InstCombine/overflow.ll25
1 files changed, 17 insertions, 8 deletions
diff --git a/test/Transforms/InstCombine/overflow.ll b/test/Transforms/InstCombine/overflow.ll
index 81ceef8c41..d8e3be3c94 100644
--- a/test/Transforms/InstCombine/overflow.ll
+++ b/test/Transforms/InstCombine/overflow.ll
@@ -1,17 +1,24 @@
; RUN: opt -S -instcombine < %s | FileCheck %s
; <rdar://problem/8558713>
+; @LOCALMOD-BEGIN
+; PNaCl does not support the with.overflow intrinsics in its stable
+; ABI, so these optimizations are disabled.
+
+; RUN: opt -S -instcombine < %s | FileCheck %s -check-prefix=PNACL
+; PNACL-NOT: with.overflow
+
declare void @throwAnExceptionOrWhatever()
; CHECK: @test1
define i32 @test1(i32 %a, i32 %b) nounwind ssp {
entry:
-; CHECK-NOT: sext
+; C;HECK-NOT: sext
%conv = sext i32 %a to i64
%conv2 = sext i32 %b to i64
%add = add nsw i64 %conv2, %conv
%add.off = add i64 %add, 2147483648
-; CHECK: llvm.sadd.with.overflow.i32
+; C;HECK: llvm.sadd.with.overflow.i32
%0 = icmp ugt i64 %add.off, 4294967295
br i1 %0, label %if.then, label %if.end
@@ -20,9 +27,9 @@ if.then:
br label %if.end
if.end:
-; CHECK-NOT: trunc
+; C;HECK-NOT: trunc
%conv9 = trunc i64 %add to i32
-; CHECK: ret i32
+; C;HECK: ret i32
ret i32 %conv9
}
@@ -86,7 +93,7 @@ entry:
%add4 = add nsw i32 %add, 128
%cmp = icmp ugt i32 %add4, 255
br i1 %cmp, label %if.then, label %if.end
-; CHECK: llvm.sadd.with.overflow.i8
+; C;HECK: llvm.sadd.with.overflow.i8
if.then: ; preds = %entry
tail call void @throwAnExceptionOrWhatever() nounwind
unreachable
@@ -98,7 +105,7 @@ if.end: ; preds = %entry
}
; CHECK: @test5
-; CHECK: llvm.uadd.with.overflow
+; C;HECK: llvm.uadd.with.overflow
; CHECK: ret i64
define i64 @test5(i64 %a, i64 %b) nounwind ssp {
entry:
@@ -109,7 +116,7 @@ entry:
}
; CHECK: @test6
-; CHECK: llvm.uadd.with.overflow
+; C;HECK: llvm.uadd.with.overflow
; CHECK: ret i64
define i64 @test6(i64 %a, i64 %b) nounwind ssp {
entry:
@@ -120,7 +127,7 @@ entry:
}
; CHECK: @test7
-; CHECK: llvm.uadd.with.overflow
+; C;HECK: llvm.uadd.with.overflow
; CHECK: ret i64
define i64 @test7(i64 %a, i64 %b) nounwind ssp {
entry:
@@ -153,3 +160,5 @@ if.end:
%conv9 = trunc i64 %add to i32
ret i32 %conv9
}
+
+; @LOCALMOD-END