diff options
author | Dan Gohman <dan433584@gmail.com> | 2017-11-28 05:36:42 +0000 |
---|---|---|
committer | Dan Gohman <dan433584@gmail.com> | 2017-11-28 05:36:42 +0000 |
commit | 8aaa99a5066e932a3e2548212db2884c00f21a1e (patch) | |
tree | 246fa6bc546c4d7d113c1d28e910cd347d035332 /test/CodeGen/WebAssembly | |
parent | ade49e463b457759cf4ec9de39d458455af0c0d8 (diff) |
[WebAssembly] Handle errors better in fast-isel.
Fast-isel routines need to bail out in the case that fast-isel
fails on the operands.
This fixes https://bugs.llvm.org/show_bug.cgi?id=35064
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319144 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/WebAssembly')
-rw-r--r-- | test/CodeGen/WebAssembly/fast-isel-noreg.ll | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/test/CodeGen/WebAssembly/fast-isel-noreg.ll b/test/CodeGen/WebAssembly/fast-isel-noreg.ll index 229651d093f..d0f60f22a27 100644 --- a/test/CodeGen/WebAssembly/fast-isel-noreg.ll +++ b/test/CodeGen/WebAssembly/fast-isel-noreg.ll @@ -32,4 +32,58 @@ entry: ret i32 0 } +; CHECK: i32.const {{.*}}, addr@FUNCTION +; CHECK: i32.const {{.*}}, 24 +; CHECK: i32.shl +; CHECK: i32.const {{.*}}, 24 +; CHECK: i32.shr_s +; CHECK: i32.const {{.*}}, 64 +; CHECK: br_if 0, $pop0 +define hidden i32 @d() #0 { +entry: + %t = icmp slt i8 ptrtoint (void ()* @addr to i8), 64 + br i1 %t, label %a, label %b +a: + unreachable +b: + ret i32 0 +} + +; CHECK: i32.const {{.*}}, addr@FUNCTION +; CHECK: i32.const {{.*}}, 255 +; CHECK: i32.and +; CHECK: i32.const {{.*}}, 64 +; CHECK: br_if 0, $pop0 +define hidden i32 @e() #0 { +entry: + %t = icmp ult i8 ptrtoint (void ()* @addr to i8), 64 + br i1 %t, label %a, label %b +a: + unreachable +b: + ret i32 0 +} + +; CHECK: i32.const {{.*}}, addr@FUNCTION +; CHECK: i32.const {{.*}}, 24 +; CHECK: i32.shl +; CHECK: i32.const {{.*}}, 24 +; CHECK: i32.shr_s +define hidden i32 @f() #0 { +entry: + %t = sext i8 ptrtoint (void ()* @addr to i8) to i32 + ret i32 %t +} + +; CHECK: i32.const {{.*}}, addr@FUNCTION +; CHECK: i32.const {{.*}}, 255 +; CHECK: i32.and +define hidden i32 @g() #0 { +entry: + %t = zext i8 ptrtoint (void ()* @addr to i8) to i32 + ret i32 %t +} + +declare void @addr() + attributes #0 = { noinline optnone } |