diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-07-25 14:49:26 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-07-25 14:49:26 +0000 |
commit | 6b6fdc992a826f66c1eb3b1e2a08220e29042891 (patch) | |
tree | cdab3c206a971a0920102a070a1811a169ea6b54 /llvm/test/Bitcode | |
parent | 115d2df8a4406959fd0b62b205611bb75773aab3 (diff) | |
download | bcm5719-llvm-6b6fdc992a826f66c1eb3b1e2a08220e29042891.tar.gz bcm5719-llvm-6b6fdc992a826f66c1eb3b1e2a08220e29042891.zip |
IPO: Add use-list-order verifier
Add a -verify-use-list-order pass, which shuffles use-list order, writes
to bitcode, reads back, and verifies that the (shuffled) order matches.
- The utility functions live in lib/IR/UseListOrder.cpp.
- Moved (and renamed) the command-line option to enable writing
use-lists, so that this pass can return early if the use-list orders
aren't being serialized.
It's not clear that this pass is the right direction long-term (perhaps
a separate tool instead?), but short-term it's a great way to test the
use-list order prototype. I've added an XFAIL-ed testcase that I'm
hoping to get working pretty quickly.
This is part of PR5680.
llvm-svn: 213945
Diffstat (limited to 'llvm/test/Bitcode')
-rw-r--r-- | llvm/test/Bitcode/use-list-order.ll | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/llvm/test/Bitcode/use-list-order.ll b/llvm/test/Bitcode/use-list-order.ll new file mode 100644 index 00000000000..6d87dedee51 --- /dev/null +++ b/llvm/test/Bitcode/use-list-order.ll @@ -0,0 +1,83 @@ +; RUN: opt -S < %s -preserve-bc-use-list-order -verify-use-list-order +; XFAIL: * + +@a = global [4 x i1] [i1 0, i1 1, i1 0, i1 1] +@b = alias i1* getelementptr ([4 x i1]* @a, i64 0, i64 2) + +define i64 @f(i64 %f) { +entry: + %sum = add i64 %f, 0 + ret i64 %sum +} + +define i64 @g(i64 %g) { +entry: + %sum = add i64 %g, 0 + ret i64 %sum +} + +define i64 @h(i64 %h) { +entry: + %sum = add i64 %h, 0 + ret i64 %sum +} + +define i64 @i(i64 %i) { +entry: + %sum = add i64 %i, 1 + ret i64 %sum +} + +define i64 @j(i64 %j) { +entry: + %sum = add i64 %j, 1 + ret i64 %sum +} + +define i64 @k(i64 %k) { +entry: + %sum = add i64 %k, 1 + ret i64 %sum +} + +define i64 @l(i64 %l) { +entry: + %sum = add i64 %l, 1 + ret i64 %sum +} + +define i1 @loadb() { +entry: + %b = load i1* @b + ret i1 %b +} + +define i1 @loada() { +entry: + %a = load i1* getelementptr ([4 x i1]* @a, i64 0, i64 2) + ret i1 %a +} + +define i32 @f32(i32 %a, i32 %b, i32 %c, i32 %d) { +entry: + br label %first + +second: + %eh = mul i32 %e, %h + %sum = add i32 %eh, %ef + br label %exit + +exit: + %product = phi i32 [%ef, %first], [%sum, %second] + ret i32 %product + +first: + %e = add i32 %a, 7 + %f = add i32 %b, 7 + %g = add i32 %c, 8 + %h = add i32 %d, 8 + %ef = mul i32 %e, %f + %gh = mul i32 %g, %h + %gotosecond = icmp slt i32 %gh, -9 + br i1 %gotosecond, label %second, label %exit +} |