Fix a case in SROA where lifetime intrinsics could inhibit alloca promotion. In
[oota-llvm.git] / lib / Transforms / Scalar / SROA.cpp
index 735dd632f01bdfdff853cd2239fbae3041ce8df2..2ed4c3716181e31295f4343e608b16f5721108ee 100644 (file)
@@ -1659,6 +1659,10 @@ static bool isVectorPromotionViableForSlice(
       return false;
     if (!I->isSplittable())
       return false; // Skip any unsplittable intrinsics.
+  } else if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(U->getUser())) {
+    if (II->getIntrinsicID() != Intrinsic::lifetime_start &&
+        II->getIntrinsicID() != Intrinsic::lifetime_end)
+      return false;
   } else if (U->get()->getType()->getPointerElementType()->isStructTy()) {
     // Disable vector promotion when there are loads or stores of an FCA.
     return false;