This is an archive of the discontinued LLVM Phabricator instance.

[thumb,framelowering] Reset NoVRegs in Thumb1FrameLowering::emitPrologue.
ClosedPublic

Authored by fhahn on Jan 17 2017, 2:57 PM.

Details

Summary

In this function, virtual registers can be introduced (for example
through calls to emitThumbRegPlusImmInReg). doScavengeFrameVirtualRegs
will replace those virtual registers with concrete registers later on
in PrologEpilogInserter, which sets NoVRegs again.

This patch fixes the Codegen/Thumb/segmented-stacks.ll test case which
failed with expensive checks.
https://llvm.org/bugs/show_bug.cgi?id=27484

Diff Detail

Event Timeline

fhahn created this revision.Jan 17 2017, 2:57 PM

This makes sense to me, but I'll let Oliver have the final say, as this is his area.

Also, can you add a test, please?

cheers,
--renato

fhahn added a comment.Jan 18 2017, 4:02 AM

Thanks for having a look! Unfortunately I have no idea how to add a test. The problem is only exposed because ARMFrameLowering::adjustForSegmentedStacks verifies the machine function if expensive checks are enabled (which makes sure no virtual registers are present in functions marked as NoVRegs). The NoVRegs property is only violated inside the PrologEpilogInserter pass until doScavengeFrameVirtualRegs is called.

Cheers,
Florian

olista01 accepted this revision.Jan 18 2017, 4:10 AM

I also can't see any way to test this other than turning on expensive checks (which already catches it), so LGTM.

This revision is now accepted and ready to land.Jan 18 2017, 4:10 AM
fhahn closed this revision.Jan 18 2017, 7:12 AM