[cfe-dev] More LLVM on VC2010 fun

Matthieu Monrocq matthieu.monrocq at gmail.com
Tue Jul 24 10:46:19 PDT 2012


On Tue, Jul 24, 2012 at 2:22 PM, Unai Landa <ulanda at digital-legends.com>wrote:

>  After debuging I have been able to fix the issue;
>
>
> I changed 2 lines on PeepholeOptimizer.cpp
> Line 410:
> from: for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I !=
> E; ++I) {
>
> to:  for (MachineFunction::iterator I = MF.begin(); I !=MF.end(); ++I) {
>
>
>
> And line 421
>
> from: MII = I->begin(), MIE = I->end(); MII != MIE; ) {
>
> to:   MII = I->begin() ; MII != I->end(); ) {
>
>
>
> This fixes teh problem, but I suspect that it comes from OptimizeExtInstr
> as it seems removesome items from the vector.
>
>
>
> I'll do a full rebuild with this change and check if this fixes my issues.
>
>
>
> How should I manage this change? my fix, should work, but the may be the
> issue is located at other function, does the PeepholeOptimizer.cpp have
> owner?
>
>
>
> Unai.
>
>
Note: if items are removed from a vector, then the current iterator should
be reassigned to too, as in

V::iterator it = v.begin();
it = v.erase(it);

Even though for vector it is likely to still work without this (as they are
probably barebone pointers under the cover), a debug version of a STL would
catch the use of `it` after the call to erase with an assertion.

If you correct the loops checks, could you also take care of updating the
iterator's value ?

-- Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120724/e79473c9/attachment.html>


More information about the cfe-dev mailing list