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(%class.A* nocapture %this, i32 %BoolValue) nounwind uwtable {
20 %cmp = icmp eq i32 %BoolValue, 0
21 %address1 = getelementptr inbounds %class.A, %class.A* %this, i64 0, i32 0, i32 3
22 %address2 = getelementptr inbounds %class.A, %class.A* %this, i64 0, i32 0, i32 1
23 br i1 %cmp, label %if.else, label %if.then
25 if.then: ; preds = %entry
26 %0 = getelementptr inbounds %class.D, %class.D* %address2, i64 0, i32 0, i64 0, i32 0
27 %1 = load float, float* %0, align 4
28 %2 = getelementptr inbounds float, float* %0, i64 3
29 %3 = load float, float* %2, align 4
30 %4 = getelementptr inbounds %class.D, %class.D* %address1, i64 0, i32 0, i64 0, i32 0
31 store float %1, float* %4, align 4
34 if.else: ; preds = %entry
37 if.end: ; preds = %if.then, %if.else, %entry
42 ; CHECK: movss 12([[THIS:%[a-zA-Z0-9]+]]), [[REGISTER:%[a-zA-Z0-9]+]]
43 ; CHECK-NEXT: movss [[REGISTER]], 60([[THIS]])