Home | History | Annotate | Download | only in GVN
      1 ; RUN: opt -basicaa -gvn -S %s | FileCheck %s
      2 
      3 %MyStruct = type { i32, i32 }
      4 define i8 @foo(i64 %in, i8* %arr) {
      5   %addr = alloca %MyStruct
      6   %dead = trunc i64 %in to i32
      7   br i1 undef, label %next, label %tmp
      8 
      9 tmp:
     10   call void @bar()
     11   br label %next
     12 
     13 next:
     14   %addr64 = bitcast %MyStruct* %addr to i64*
     15   store i64 %in, i64* %addr64
     16   br label %final
     17 
     18 final:
     19   %addr32 = getelementptr %MyStruct, %MyStruct* %addr, i32 0, i32 0
     20   %idx32 = load i32, i32* %addr32
     21 
     22 ; CHECK: %resptr = getelementptr i8, i8* %arr, i32 %dead
     23   %resptr = getelementptr i8, i8* %arr, i32 %idx32
     24   %res = load i8, i8* %resptr
     25 
     26   ret i8 %res
     27 }
     28 
     29 declare void @bar()
     30