This is an archive of the discontinued LLVM Phabricator instance.

Skip base pointer usage if SP isn't touched by asm
ClosedPublic

Authored by rnk on Aug 7 2013, 5:33 PM.

Details

Summary

Now we emit a fatal error if we needed to realign the stack and we had stack adjusting inline asm. We could try to do better by analyzing the inline asm constraints for conflicts with our chosen base register, but that is hard to do through the CodeGen / Target layers.

Fixes miscompiles in PR16830, but we now fail to compile some programs.

Diff Detail

Event Timeline

rnk updated this revision to Unknown Object (????).Aug 13 2013, 6:09 PM
  • Add a fatal error.
rnk added a comment.Sep 26 2013, 11:28 AM

Ping. I almost forgot about this because I worked around it in llvm/lib/Support/Host.cpp.

rnk updated this revision to Unknown Object (????).Dec 6 2013, 2:58 PM
  • Analyze the inline asm for implicit defs and add them to clobbers
  • Only force the use of esi when the inline asm actually clobbers esp
sunfish accepted this revision.Dec 9 2013, 1:51 PM

Reading this patch, everything looks fine, though that's no guarantee that there aren't any unanticipated interactions.

rnk added a comment.Dec 9 2013, 9:20 PM

Thanks!

What I anticipate is that someone somewhere will hit the fatal error path with:

  • a stack realignment
  • inline asm
  • a dynamic alloca

... and complain. But that's OK, because it's better than a miscompile. :)

rnk closed this revision.Dec 9 2013, 9:26 PM

Closed by commit rL196876 (authored by @rnk).