diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-02-01 15:21:10 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-02-01 15:21:10 +0000 |
commit | c05aa958b1244bd632431d6715cf3088c14a09c3 (patch) | |
tree | 268160787078292bba62d0664d6551a24851c620 /llvm/test/Transforms | |
parent | f23fc86ca89c0db2617be724e9dcb96ec95236c0 (diff) | |
download | bcm5719-llvm-c05aa958b1244bd632431d6715cf3088c14a09c3.tar.gz bcm5719-llvm-c05aa958b1244bd632431d6715cf3088c14a09c3.zip |
InstSimplify: stripAndComputeConstantOffsets can be called with vectors of pointers too.
Prepare it for vectors of pointers and handle simple cases. We don't handle
complicated cases because accumulateConstantOffset bails on pointer vectors.
Fixes selfhost on i386.
llvm-svn: 174179
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r-- | llvm/test/Transforms/InstSimplify/ptr_diff.ll | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/ptr_diff.ll b/llvm/test/Transforms/InstSimplify/ptr_diff.ll index 1eb1fd4c097..86516280696 100644 --- a/llvm/test/Transforms/InstSimplify/ptr_diff.ll +++ b/llvm/test/Transforms/InstSimplify/ptr_diff.ll @@ -46,3 +46,14 @@ define i64 @ptrdiff3(i8* %ptr) { %diff = sub i64 %last.int, %first.int ret i64 %diff } + +define <4 x i32> @ptrdiff4(<4 x i8*> %arg) nounwind { +; Handle simple cases of vectors of pointers. +; CHECK: @ptrdiff4 +; CHECK: ret <4 x i32> zeroinitializer + %p1 = ptrtoint <4 x i8*> %arg to <4 x i32> + %bc = bitcast <4 x i8*> %arg to <4 x i32*> + %p2 = ptrtoint <4 x i32*> %bc to <4 x i32> + %sub = sub <4 x i32> %p1, %p2 + ret <4 x i32> %sub +} |