================
@@ -2189,6 +2198,25 @@ CIRABIRewriteContext::rewriteCallSite(mlir::Operation 
*callOp,
     if (ac.kind == ArgKind::Ignore)
       continue;
     mlir::Value arg = argOperands[idx];
+
+    // Refreeze after the ABI rewrite, as classic CodeGen does, so padding is
+    // frozen too. Indirect freezes only the pointer, so keep non-load freezes.
+    auto freeze = arg.getDefiningOp<cir::FreezeOp>();
+    if (freeze && freeze->hasOneUse() &&
+        (ac.kind != ArgKind::Indirect ||
+         freeze.getInput().getDefiningOp<cir::LoadOp>())) {
+      arg = freeze.getInput();
+      deadFreezes.push_back(freeze);
+    } else {
+      freeze = {};
+    }
+    llvm::scope_exit refreeze([&, firstNewArg = newArgs.size()] {
----------------
aobolensk wrote:

Replaced the scope_exit

Loop records where each argument starts in newArgs and creates the freezes 
after the loop, so an error exit creates none

https://github.com/llvm/llvm-project/pull/234124
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to