Dominique Torette via llvm-dev
2017-Sep-27 12:54 UTC
[llvm-dev] PEI::replaceFrameIndices() endless loop
Hi,
My backend (based on version 3.8) was hanging in an infinite loop in the
Prolog/Epilog Inserter.
After investigation, it appears that it was looping in the first level loop of
the PEI::replaceFrameIndices() method: processing the second instruction of the
block again and again...
This loop never exits because the iterator is 'skipped backward' under
some condition in the middle of the loop (see yellow highlighted line).
I understand the rationale explained in the first comment, but I don't
understand how the condition ("not the first instruction") is related
to this rationale.
I have commented out the iterator decrement and then my back-end behave
correctly.
The handling of this loop iterator is quite complex: skipping backward or
forward in not so clearly raised conditions.
Could someone review the logic of this iterator to confirm its correctness? Or
is it a bug?
// Some instructions (e.g. inline asm instructions) can have
// multiple frame indices and/or cause eliminateFrameIndex
// to insert more than one instruction. We need the register
// scavenger to go through all of these instructions so that
// it can update its register information. We keep the
// iterator at the point before insertion so that we can
// revisit them in full.
bool AtBeginning = (I == BB->begin());
if (!AtBeginning) --I;
// If this instruction has a FrameIndex operand, we need to
// use that target machine register info object to eliminate
// it.
TRI.eliminateFrameIndex(MI, SPAdj, i,
FrameIndexVirtualScavenging ? nullptr : RS);
Regards, Dominique Torette.
[http://www.spacebel.be/wp-content/uploads/2011/06/image-sign-sbp.jpg]
Dominique Torette
System Architect
Rue des Chasseurs Ardennais - Liège Science Park - B-4031 Angleur
Tel: +32 (0) 4 361 81 11 - Fax: +32 (0) 4 361 81 20
www.spacebel.be<http://www.spacebel.be/>
------------------------------------------------------------------------------
E-MAIL DISCLAIMER
The present message may contain confidential and/or legally privileged
information. If you are not the intended addressee and in case of a transmission
error, please notify the sender immediately and destroy this E-mail. Disclosure,
reproduction or distribution of this document and its possible attachments is
strictly forbidden.
SPACEBEL denies all liability for incomplete, improper, inaccurate, intercepted,
(partly) destroyed, lost and/or belated transmission of the current information
given that unencrypted electronic transmission cannot currently be guaranteed to
be secure or error free.
Upon request or in conformity with formal, contractual agreements, an originally
signed hard copy will be sent to you to confirm the information contained in
this E-mail.
SPACEBEL denies all liability where E-mail is used for private use.
SPACEBEL cannot be held responsible for possible viruses that might corrupt this
message and/or your computer system.
-------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20170927/b23e303b/attachment.html>
