1 ; RUN: opt < %s -basicaa -globals-aa -gvn -instcombine -S -enable-unsafe-globalsmodref-alias-results | FileCheck %s
3 ; Note that this test relies on an unsafe feature of GlobalsModRef. While this
4 ; test is correct and safe, GMR's technique for handling this isn't generally.
6 @G = internal global i32* null ; <i32**> [#uses=3]
8 declare i8* @malloc(i32)
10 %a = call i8* @malloc(i32 4)
11 %A = bitcast i8* %a to i32*
12 store i32* %A, i32** @G
16 define i32 @test1(i32* %P) {
18 %g1 = load i32*, i32** @G ; <i32*> [#uses=2]
19 %h1 = load i32, i32* %g1 ; <i32> [#uses=1]
20 store i32 123, i32* %P
21 %g2 = load i32*, i32** @G ; <i32*> [#uses=0]
22 %h2 = load i32, i32* %g1 ; <i32> [#uses=1]
23 %X = sub i32 %h1, %h2 ; <i32> [#uses=1]