[PATCH] D30835: [DebugInfo][X86] Teach Optimize LEAs pass to handle debug values
Andrew Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 17 09:57:01 PDT 2017
andrewng added a comment.
Thanks for the review.
================
Comment at: lib/Target/X86/X86OptimizeLEAs.cpp:567-568
+ unsigned LastVReg = Last.getOperand(0).getReg();
+ for (auto UI = MRI->use_nodbg_begin(LastVReg),
+ UE = MRI->use_nodbg_end();
UI != UE;) {
----------------
dblaikie wrote:
> I think you can use:
>
> for (MachineOperand &MO : MRI->use_nodbg_operands(LastVReg))
>
> here, probably?
Yes, at first I thought so too, but inside the loop there is:
```
MO.setReg(First.getOperand(0).getReg());
```
which could affect the use iterator. So the original code which increments the use iterator before any changes is safer.
https://reviews.llvm.org/D30835
More information about the llvm-commits
mailing list