Fix PR13969, a mini-phase-ordering issue with the new SROA pass.
[oota-llvm.git] / test / Transforms / SROA / basictest.ll
index b6d08ba8c8a90df3b889f3b61cc8d30aa043bac2..a58eb4786cd7d434a53eb14b9b19d10b32b35f16 100644 (file)
@@ -926,3 +926,27 @@ bb3:
 bb4:
   unreachable
 }
+
+define double @PR13969(double %x) {
+; Check that we detect when promotion will un-escape an alloca and iterate to
+; re-try running SROA over that alloca. Without that, the two allocas that are
+; stored into a dead alloca don't get rewritten and promoted.
+; CHECK: @PR13969
+
+entry:
+  %a = alloca double
+  %b = alloca double*
+  %c = alloca double
+; CHECK-NOT: alloca
+
+  store double %x, double* %a
+  store double* %c, double** %b
+  store double* %a, double** %b
+  store double %x, double* %c
+  %ret = load double* %a
+; CHECK-NOT: store
+; CHECK-NOT: load
+
+  ret double %ret
+; CHECK: ret double %x
+}