1; RUN: opt < %s -basicaa -globals-aa -gvn -instcombine -S -enable-unsafe-globalsmodref-alias-results | FileCheck %s 2; 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. 5 6@G = internal global i32* null ; <i32**> [#uses=3] 7 8declare i8* @malloc(i32) 9define void @test() { 10 %a = call i8* @malloc(i32 4) 11 %A = bitcast i8* %a to i32* 12 store i32* %A, i32** @G 13 ret void 14} 15 16define i32 @test1(i32* %P) { 17; CHECK: ret i32 0 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] 24 ret i32 %X 25} 26