[llvm] [SROA] Rewrite invariant group intrinsics after splitting alloca (PR #107557)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 1 06:24:29 PDT 2024


================
@@ -3531,8 +3531,19 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
       return true;
     }
 
-    if (II.isLaunderOrStripInvariantGroup())
+    if (II.isLaunderOrStripInvariantGroup()) {
+      Value *AdjustedPtr = getNewAllocaSlicePtr(IRB, OldPtr->getType());
+      Value *New = nullptr;
+      if (II.getIntrinsicID() == Intrinsic::launder_invariant_group)
+        New = IRB.CreateLaunderInvariantGroup(AdjustedPtr);
+      else if (II.getIntrinsicID() == Intrinsic::strip_invariant_group)
+        New = IRB.CreateStripInvariantGroup(AdjustedPtr);
+
+      New->takeName(&II);
+      II.replaceAllUsesWith(New);
----------------
nikic wrote:

Is this RAUW correct? Can't the alloca be split into two parts, both of which need their own intrinsic?

https://github.com/llvm/llvm-project/pull/107557


More information about the llvm-commits mailing list