LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 13378 - Assertion in LiveIntervals
Summary: Assertion in LiveIntervals
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Common Code Generator Code (show other bugs)
Version: trunk
Hardware: PC All
: P enhancement
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-16 17:10 PDT by Anton Korobeynikov
Modified: 2012-07-18 15:18 PDT (History)
5 users (show)

See Also:
Fixed By Commit(s):


Attachments
Testcase (2.33 KB, application/octet-stream)
2012-07-16 17:10 PDT, Anton Korobeynikov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Korobeynikov 2012-07-16 17:10:50 PDT
Created attachment 8912 [details]
Testcase

Consider the attached testcase. Running llc -mcpu=cortex-a9 on it yields assertions fail.
Comment 1 Jakob Stoklund Olesen 2012-07-16 18:12:18 PDT
RescheduleMIBelowKill is moving an INSERT_SUBREG instruction, and then it never gets revisited, so we don't insert the required COPY in front of it.
Comment 2 Chandler Carruth 2012-07-16 18:20:31 PDT
Interesting, looking into this... don't yet have a strong understanding of the change in behavior...
Comment 3 Jakob Stoklund Olesen 2012-07-16 18:27:26 PDT
Honestly, I get lost in those giant nested loops. It might help to extract a few methods.

INSERT_SUBREG gets partial special treatment because we need to both insert a COPY in front and change the instruction itself into a subreg COPY.
Comment 4 Chandler Carruth 2012-07-16 19:27:36 PDT
Note that this reproduces for me even with r160228 reverted.
Comment 5 Jakob Stoklund Olesen 2012-07-17 12:51:13 PDT
You touch it, you own it ;-)

Chad, ISTR you asking me about INSERT_SUBREG and RescheduleMIBelowKill. Do you remember how it is supposed to work?
Comment 6 Chad Rosier 2012-07-17 13:03:04 PDT
Unfortunately, I don't recall.
Comment 7 Chandler Carruth 2012-07-18 05:40:00 PDT
(In reply to comment #5)
> You touch it, you own it ;-)

Careful what you wish for?

(And no, I'm not owning it... but I'll try to help when I can... ;])

I've mailed a patch that I think fixes this to -commits for review. I've included a (far too) lengthy write up of the debugging process I went through in the hope of learning whether I've got any clue how this thing works, and maybe helping some others learn as well.
Comment 8 Jakob Stoklund Olesen 2012-07-18 10:47:53 PDT
Thanks, Chandler. It looks like I broke it in r159120. I suppose "you break it, you own it" takes precedence ;-)

To summarize Chandler's analysis, when an INSERT_SUBREG instruction is rescheduled, operand processing is deferring until we reach the instruction the second time. However, the code that rewrites INSERT_SUBREG to COPY was accidentally not deferred, so the second time around we see a COPY which isn't a 2-addr instruction.
Comment 9 Chandler Carruth 2012-07-18 13:58:54 PDT
Fix committed in r160443.