[PATCH] D122375: [CoroSplit] Handle argument being the frame pointer

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 30 21:49:00 PDT 2022


rjmccall added inline comments.


================
Comment at: llvm/lib/Transforms/Coroutines/CoroSplit.cpp:874
 
-  // Replace all args with undefs. The buildCoroutineFrame algorithm already
-  // rewritten access to the args that occurs after suspend points with loads
-  // and stores to/from the coroutine frame.
-  for (Argument &A : OrigF.args())
-    VMap[&A] = UndefValue::get(A.getType());
+  // Replace all args with dummy instructions, which we'll drop later.
+  SmallVector<Instruction *> DummyArgs;
----------------
Please explain why we need to do this in the comment, so that future maintainers aren't forced to track the commit all the way back to this conversation to understand it.  And then the comment on the replacement later can just be something like "all uses of the arguments should have been resolved by this point, so we can safely remove the dummy values".


================
Comment at: llvm/lib/Transforms/Coroutines/CoroSplit.cpp:878
+    DummyArgs.push_back(
+        new BitCastInst(UndefValue::get(A.getType()), A.getType()));
+    VMap[&A] = DummyArgs.back();
----------------
Is it really okay to add an unparented instruction to the value map?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122375/new/

https://reviews.llvm.org/D122375



More information about the llvm-commits mailing list