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

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 09:01:11 PDT 2020


bjope added inline comments.


================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:5959
   for (auto *I : DeletedInstrs) {
     I->replaceAllUsesWith(UndefValue::get(I->getType()));
     I->eraseFromParent();
----------------
I guess this is what makes the dbg.value after the phi to be invalidated (getting undef as value instead of the phi result)?

Techincally I think it would have been OK to replace uses in dbg.value with the new PHI result (such as changing from i32 to float). At least salvageDebugInfoImpl in Local.cpp seem to just look through no-op-casts when. Maybe it isn't that important to deal with it here. I think it is more complicated than just calling salvageDebugInfo(*I) here, since it won't detect that you replaced the PHI with a new PHI. But maybe it is worth a comment explaining that we don't salvage any debug uses here (even thought it could be done in the future).


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

https://reviews.llvm.org/D82678



More information about the llvm-commits mailing list