diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2015-09-08 22:49:35 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2015-09-08 22:49:35 +0000 |
commit | 8d24ae9441eee4b6fe4512ba8262638deef11e07 (patch) | |
tree | b31e2266f9f11411c318aa5bcd3354fde74d3af8 /llvm/test/Transforms/LowerBitSets/function.ll | |
parent | 0d0200d727927ee7b20581f52066915b22c16105 (diff) | |
download | bcm5719-llvm-8d24ae9441eee4b6fe4512ba8262638deef11e07.tar.gz bcm5719-llvm-8d24ae9441eee4b6fe4512ba8262638deef11e07.zip |
Re-apply r247080 with order of evaluation fix.
llvm-svn: 247095
Diffstat (limited to 'llvm/test/Transforms/LowerBitSets/function.ll')
-rw-r--r-- | llvm/test/Transforms/LowerBitSets/function.ll | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LowerBitSets/function.ll b/llvm/test/Transforms/LowerBitSets/function.ll new file mode 100644 index 00000000000..0aa947e5a2d --- /dev/null +++ b/llvm/test/Transforms/LowerBitSets/function.ll @@ -0,0 +1,35 @@ +; RUN: opt -S -lowerbitsets < %s | FileCheck %s + +; Tests that we correctly create a jump table for bitsets containing 2 or more +; functions. + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-p:64:64" + +; CHECK: @[[JT:.*]] = private constant [2 x <{ i8, i32, i8, i8, i8 }>] [<{ i8, i32, i8, i8, i8 }> <{ i8 -23, i32 trunc (i64 sub (i64 sub (i64 ptrtoint (void ()* @[[FNAME:.*]] to i64), i64 ptrtoint ([2 x <{ i8, i32, i8, i8, i8 }>]* @[[JT]] to i64)), i64 5) to i32), i8 -52, i8 -52, i8 -52 }>, <{ i8, i32, i8, i8, i8 }> <{ i8 -23, i32 trunc (i64 sub (i64 sub (i64 ptrtoint (void ()* @[[GNAME:.*]] to i64), i64 ptrtoint ([2 x <{ i8, i32, i8, i8, i8 }>]* @[[JT]] to i64)), i64 13) to i32), i8 -52, i8 -52, i8 -52 }>], section ".text" + +; CHECK: @f = alias bitcast ([2 x <{ i8, i32, i8, i8, i8 }>]* @[[JT]] to void ()*) +; CHECK: @g = alias bitcast (<{ i8, i32, i8, i8, i8 }>* getelementptr inbounds ([2 x <{ i8, i32, i8, i8, i8 }>], [2 x <{ i8, i32, i8, i8, i8 }>]* @[[JT]], i64 0, i64 1) to void ()*) + +; CHECK: define private void @[[FNAME]]() { +define void @f() { + ret void +} + +; CHECK: define private void @[[GNAME]]() { +define void @g() { + ret void +} + +!0 = !{!"bitset1", void ()* @f, i32 0} +!1 = !{!"bitset1", void ()* @g, i32 0} + +!llvm.bitsets = !{ !0, !1 } + +declare i1 @llvm.bitset.test(i8* %ptr, metadata %bitset) nounwind readnone + +define i1 @foo(i8* %p) { + ; CHECK: sub i64 {{.*}}, ptrtoint ([2 x <{ i8, i32, i8, i8, i8 }>]* @[[JT]] to i64) + %x = call i1 @llvm.bitset.test(i8* %p, metadata !"bitset1") + ret i1 %x +} |