summaryrefslogtreecommitdiff
path: root/test/Transforms/SROA/phi-and-select.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/SROA/phi-and-select.ll')
-rw-r--r--test/Transforms/SROA/phi-and-select.ll32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/Transforms/SROA/phi-and-select.ll b/test/Transforms/SROA/phi-and-select.ll
index fb76548b1d1..e7ba2e89d79 100644
--- a/test/Transforms/SROA/phi-and-select.ll
+++ b/test/Transforms/SROA/phi-and-select.ll
@@ -600,3 +600,35 @@ if.then5: ; preds = %if.then2, %if.end
store %struct.S undef, %struct.S* %f1, align 4
ret void
}
+
+define i32 @phi_align(i32* %z) {
+; CHECK-LABEL: @phi_align(
+entry:
+ %a = alloca [8 x i8], align 8
+; CHECK: alloca [7 x i8]
+
+ %a0x = getelementptr [8 x i8], [8 x i8]* %a, i64 0, i32 1
+ %a0 = bitcast i8* %a0x to i32*
+ %a1x = getelementptr [8 x i8], [8 x i8]* %a, i64 0, i32 4
+ %a1 = bitcast i8* %a1x to i32*
+; CHECK: store i32 0, {{.*}}, align 1
+ store i32 0, i32* %a0, align 1
+; CHECK: store i32 1, {{.*}}, align 1
+ store i32 1, i32* %a1, align 4
+; CHECK: load {{.*}}, align 1
+ %v0 = load i32, i32* %a0, align 1
+; CHECK: load {{.*}}, align 1
+ %v1 = load i32, i32* %a1, align 4
+ %cond = icmp sle i32 %v0, %v1
+ br i1 %cond, label %then, label %exit
+
+then:
+ br label %exit
+
+exit:
+; CHECK: %phi = phi i32* [ {{.*}}, %then ], [ %z, %entry ]
+; CHECK-NEXT: %result = load i32, i32* %phi, align 1
+ %phi = phi i32* [ %a1, %then ], [ %z, %entry ]
+ %result = load i32, i32* %phi, align 4
+ ret i32 %result
+}