diff options
author | Dan Gohman <dan433584@gmail.com> | 2013-02-01 00:11:13 +0000 |
---|---|---|
committer | Dan Gohman <dan433584@gmail.com> | 2013-02-01 00:11:13 +0000 |
commit | fdd1eafe867734df285bbdb01cf1d21f63716798 (patch) | |
tree | 9761f678d70c837174e7664fc45f04554bb03810 /test/Transforms/InstSimplify/compare.ll | |
parent | 3529d1aa8df3cfd9e37b1a4252cabc0f01652e94 (diff) | |
download | external_llvm-fdd1eafe867734df285bbdb01cf1d21f63716798.zip external_llvm-fdd1eafe867734df285bbdb01cf1d21f63716798.tar.gz external_llvm-fdd1eafe867734df285bbdb01cf1d21f63716798.tar.bz2 |
Rewrite instsimplify's handling if icmp on pointer values to remove the
remaining use of AliasAnalysis concepts such as isIdentifiedObject to
prove pointer inequality.
@external_compare in test/Transforms/InstSimplify/compare.ll shows a simple
case where a noalias argument can be equal to a global variable address, and
while AliasAnalysis can get away with saying that these pointers don't alias,
instsimplify cannot say that they are not equal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174122 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstSimplify/compare.ll')
-rw-r--r-- | test/Transforms/InstSimplify/compare.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/Transforms/InstSimplify/compare.ll b/test/Transforms/InstSimplify/compare.ll index a6d7a64..0ecfb1f 100644 --- a/test/Transforms/InstSimplify/compare.ll +++ b/test/Transforms/InstSimplify/compare.ll @@ -660,3 +660,25 @@ define i1 @alloca_argument_compare(i64* %arg) { ; CHECK: alloca_argument_compare ; CHECK: ret i1 %cmp } + +; As above, but with the operands reversed. + +define i1 @alloca_argument_compare_swapped(i64* %arg) { + %alloc = alloca i64 + %cmp = icmp eq i64* %alloc, %arg + ret i1 %cmp + ; CHECK: alloca_argument_compare_swapped + ; CHECK: ret i1 %cmp +} + +; Don't assume that a noalias argument isn't equal to a global variable's +; address. This is an example where AliasAnalysis' NoAlias concept is +; different from actual pointer inequality. + +@y = external global i32 +define zeroext i1 @external_compare(i32* noalias %x) { + %cmp = icmp eq i32* %x, @y + ret i1 %cmp + ; CHECK: external_compare + ; CHECK: ret i1 %cmp +} |