[PATCH] D82678: [CGP] Set debug locations when optimizing phi types

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 10:06:27 PDT 2020


jmorse added a reviewer: jmorse.
jmorse added a comment.
Herald added a subscriber: pengfei.

This completely fell off my radar sorry,

This looks good, particularly the extra salvaging. A question inline about whether some of it is already covered by a RAUW though.



================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:5925-5933
+    SmallVector<DbgValueInst *, 1> DbgValues;
+    findDbgValues(DbgValues, Phi);
+    for (DbgValueInst *DVI : DbgValues) {
+      // Bitcasts are apparently irrelevant for debug info. Rewrite the dbg.value
+      // to use the new phi.
+      DVI->setOperand(0, MetadataAsValue::get(Phi->getContext(),
+                                              ValueAsMetadata::get(NewPhi)));
----------------
I'm not overly familiar with this optimisation, but won't the debug users of Phi be RAUW'd to the bitcast by the next loop? If so, there Shouldn't (TM) be a need to explicitly point them at the new PHI.


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

https://reviews.llvm.org/D82678



More information about the llvm-commits mailing list