[PATCH] D31750: [globalisel] Enable tracing the legalizer with --debug-only=legalize-mir

Daniel Sanders via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 21 00:57:06 PDT 2017


dsanders added inline comments.


================
Comment at: lib/CodeGen/GlobalISel/Legalizer.cpp:204
+          DEBUG(dbgs() << ".. .. Emitted " << NumNewInsns << " insns\n");
+          for (SmallVector<MachineInstr *, 4>::iterator
+                   I = WorkList.end() - NumNewInsns,
----------------
kristof.beyls wrote:
> aditya_nandakumar wrote:
> > dsanders wrote:
> > > kristof.beyls wrote:
> > > > Minor nitpick: maybe use auto& here to make the code slightly more readable?
> > > > Otherwise, LGTM.
> > > Thanks.
> > Quick question here - is it possible that one of the instructions could have been erased as it went through legalization (and we're trying to print it)?
> I'm assuming that's not possible as the instructions being printed here are the ones added to the WorkList in this iteration, to be processed in future iterations. In other words, all of these MIs will be processed by legalizeInstrStep later on, so they shouldn't have been erased at this point.
That's right. The only way it could see an erased instruction is if a single legalizer step created an instruction and erased it again. That would be wasteful and would break the work list too.


https://reviews.llvm.org/D31750





More information about the llvm-commits mailing list