mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
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
This commit is contained in:
19
test/Analysis/BasicAA/non-escaping-local-object.ll
Normal file
19
test/Analysis/BasicAA/non-escaping-local-object.ll
Normal file
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user