blob: 13c12dc558a773103eb253413adb19a3d3e8fc62 [file] [log] [blame]
Dan Gohman3c7d3082009-09-11 18:01:28 +00001; RUN: opt < %s -anders-aa -gvn -deadargelim -S | grep store | not grep null
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002
3; Because the 'internal' function is passed to an external function, we don't
4; know what the incoming values will alias. As such, we cannot do the
Dan Gohmane1688b62008-05-23 21:15:35 +00005; optimization checked by the 'arg-must-alias.ll' test.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006
Tanya Lattnera695f012008-02-14 06:56:27 +00007declare void @external(i32(i32*)*)
8@G = internal constant i32* null
Dan Gohmanf17a25c2007-07-18 16:29:46 +00009
Tanya Lattnera695f012008-02-14 06:56:27 +000010define internal i32 @internal(i32* %ARG) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000011 ;;; We *DON'T* know that ARG always points to null!
Tanya Lattnera695f012008-02-14 06:56:27 +000012 store i32* %ARG, i32** @G
13 ret i32 0
Dan Gohmanf17a25c2007-07-18 16:29:46 +000014}
15
Tanya Lattnera695f012008-02-14 06:56:27 +000016define i32 @foo() {
17 call void @external(i32(i32*)* @internal)
18 %V = call i32 @internal(i32* null)
19 ret i32 %V
Dan Gohmanf17a25c2007-07-18 16:29:46 +000020}