diff options
| author | Dan Gohman <dan433584@gmail.com> | 2013-01-31 23:49:33 +0000 |
|---|---|---|
| committer | Dan Gohman <dan433584@gmail.com> | 2013-01-31 23:49:33 +0000 |
| commit | 995d40e1e29c85dbe301ab9fc44de1f2c0c52d72 (patch) | |
| tree | cafddfabd895f28daf383bd7171d6e474b6b63ad /llvm/test/Transforms/InstSimplify/compare.ll | |
| parent | e5d8d0d64b6cc85e8aaa750cb68e90e672937517 (diff) | |
| download | bcm5719-llvm-995d40e1e29c85dbe301ab9fc44de1f2c0c52d72.tar.gz bcm5719-llvm-995d40e1e29c85dbe301ab9fc44de1f2c0c52d72.zip | |
An alloca can be equal to an argument. It can't *alias* an alloca, but it could
be equal, since there's nothing preventing a caller from correctly predicting
the stack location of an alloca.
llvm-svn: 174119
Diffstat (limited to 'llvm/test/Transforms/InstSimplify/compare.ll')
| -rw-r--r-- | llvm/test/Transforms/InstSimplify/compare.ll | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/compare.ll b/llvm/test/Transforms/InstSimplify/compare.ll index 56627b99a47..a6d7a64b914 100644 --- a/llvm/test/Transforms/InstSimplify/compare.ll +++ b/llvm/test/Transforms/InstSimplify/compare.ll @@ -647,3 +647,16 @@ unreachableblock: %Y = icmp eq i32* %X, null ret i1 %Y } + +; It's not valid to fold a comparison of an argument with an alloca, even though +; that's tempting. An argument can't *alias* an alloca, however the aliasing rule +; relies on restrictions against guessing an object's address and dereferencing. +; There are no restrictions against guessing an object's address and comparing. + +define i1 @alloca_argument_compare(i64* %arg) { + %alloc = alloca i64 + %cmp = icmp eq i64* %arg, %alloc + ret i1 %cmp + ; CHECK: alloca_argument_compare + ; CHECK: ret i1 %cmp +} |

