1 ; RUN: opt < %s -basicaa -globalsmodref-aa -gvn -instcombine -S | FileCheck %s 2 3 @G = internal global i32* null ; <i32**> [#uses=3] 4 5 declare i8* @malloc(i32) 6 define void @test() { 7 %a = call i8* @malloc(i32 4) 8 %A = bitcast i8* %a to i32* 9 store i32* %A, i32** @G 10 ret void 11 } 12 13 define i32 @test1(i32* %P) { 14 ; CHECK: ret i32 0 15 %g1 = load i32** @G ; <i32*> [#uses=2] 16 %h1 = load i32* %g1 ; <i32> [#uses=1] 17 store i32 123, i32* %P 18 %g2 = load i32** @G ; <i32*> [#uses=0] 19 %h2 = load i32* %g1 ; <i32> [#uses=1] 20 %X = sub i32 %h1, %h2 ; <i32> [#uses=1] 21 ret i32 %X 22 } 23