diff options
author | Anders Carlsson <andersca@mac.com> | 2011-03-23 02:19:48 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2011-03-23 02:19:48 +0000 |
commit | 90af3420614fcfbcc6e2c2702fbdde144e13af86 (patch) | |
tree | b378e310969b1df382ab492691e637102683374d /test/Analysis/BasicAA | |
parent | a2f45291e1a50a571a15bbf4da38a5f42a2424ef (diff) | |
download | external_llvm-90af3420614fcfbcc6e2c2702fbdde144e13af86.zip external_llvm-90af3420614fcfbcc6e2c2702fbdde144e13af86.tar.gz external_llvm-90af3420614fcfbcc6e2c2702fbdde144e13af86.tar.bz2 |
A global variable with internal linkage where all uses are in one function and whose address is never taken is a non-escaping local object and can't alias anything else.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128140 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/BasicAA')
-rw-r--r-- | test/Analysis/BasicAA/non-escaping-local-object.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Analysis/BasicAA/non-escaping-local-object.ll b/test/Analysis/BasicAA/non-escaping-local-object.ll new file mode 100644 index 0000000..f5b73b6 --- /dev/null +++ b/test/Analysis/BasicAA/non-escaping-local-object.ll @@ -0,0 +1,19 @@ +; RUN: opt -basicaa -aa-eval -print-all-alias-modref-info -disable-output < %s |& FileCheck %s + +@global = internal global i32 0 + +declare void @should_not_be_called() +declare i32 @f() + +; CHECK: Function: g: 2 pointers, 0 call sites +define void @g(i32* nocapture %p) { + store i32 0, i32* @global + + ; @global is internal, is only used in this function, and never has its + ; address taken so it can't alias p. + ; CHECK: NoAlias: i32* %p, i32* @global + store i32 1, i32* %p + %1 = load i32* @global + ret void +} + |