1 ; RUN: llc < %s -mtriple=x86_64-pc-linux | FileCheck %s
3 ; Check that the CodeGenPrepare Pass
4 ; does not wrongly rewrite the address computed by Instruction %4
5 ; as [12 + Base:%this].
7 ; This test makes sure that:
8 ; - both the store and the first load instructions
9 ; within basic block labeled 'if.then' are not removed.
10 ; - the store instruction stores a value at address [60 + %this]
11 ; - the first load instruction loads a value at address [12 + %this]
13 %class.A = type { %struct.B }
14 %struct.B = type { %class.C, %class.D, %class.C, %class.D }
15 %class.C = type { float, float, float }
16 %class.D = type { [3 x %class.C] }
18 define linkonce_odr void @foo(ptr nocapture %this, i32 %BoolValue) nounwind uwtable {
20 %cmp = icmp eq i32 %BoolValue, 0
21 %address1 = getelementptr inbounds %class.A, ptr %this, i64 0, i32 0, i32 3
22 %address2 = getelementptr inbounds %class.A, ptr %this, i64 0, i32 0, i32 1
23 br i1 %cmp, label %if.else, label %if.then
25 if.then: ; preds = %entry
26 %0 = load float, ptr %address2, align 4
27 %1 = getelementptr inbounds float, ptr %address2, i64 3
28 %2 = load float, ptr %1, align 4
29 store float %0, ptr %address1, align 4
32 if.else: ; preds = %entry
35 if.end: ; preds = %if.then, %if.else, %entry
40 ; CHECK: movss 12([[THIS:%[a-zA-Z0-9]+]]), [[REGISTER:%[a-zA-Z0-9]+]]
41 ; CHECK-NEXT: movss [[REGISTER]], 60([[THIS]])