This is an archive of the discontinued LLVM Phabricator instance.

[PPC] Claim stack frame before storing into it, if no red zone is present
ClosedPublic

Authored by kparzysz on Aug 31 2016, 10:58 AM.

Details

Summary

PPC32/SVRV4 does not have red zone. Despite that, the frame lowering code would first save all required registers, and then update the stack pointer at the end.

This is ok on PPC64, but on PPC32 in the absence of the red zone there is no guarantee that this part of the stack will not be modified by any interrupt. To avoid this, make sure to claim the stack frame first before storing into it.

https://llvm.org/bugs/show_bug.cgi?id=26519

Diff Detail

Repository
rL LLVM

Event Timeline

kparzysz updated this revision to Diff 69885.Aug 31 2016, 10:58 AM
kparzysz retitled this revision from to [PPC] Claim stack frame before storing into it, if no red zone is present.
kparzysz updated this object.
kparzysz added a reviewer: hfinkel.
kparzysz set the repository for this revision to rL LLVM.
kparzysz added a subscriber: llvm-commits.
emaste added a subscriber: emaste.Sep 1 2016, 8:21 AM
hfinkel accepted this revision.Sep 5 2016, 1:53 AM
hfinkel edited edge metadata.

A few minor nits; otherwise, LGTM.

lib/Target/PowerPC/PPCFrameLowering.cpp
907

Please add a message with this assert, e.g.

assert(HasRedZone && "A red zone is always available on PPC64");

987

Please add a message with this assert, e.g.

assert(!isPPC64 && "A red zone is always available on PPC64");
test/CodeGen/PowerPC/stack-realign.ll
142

This line and the one above it should be CHECK-32-DAG; their order is interchangeable.

This revision is now accepted and ready to land.Sep 5 2016, 1:53 AM
This revision was automatically updated to reflect the committed changes.
kparzysz marked 3 inline comments as done.