HomePhabricator

[PowerPC] Fix wrong codegen when stack pointer has to realign performing…

Authored by lkail on Jul 21 2020, 9:16 PM.

Description

[PowerPC] Fix wrong codegen when stack pointer has to realign performing dynalloc

Current powerpc backend generates wrong code sequence if stack pointer
has to realign if -fstack-clash-protection enabled. When probing
dynamic stack allocation, current PREPARE_PROBED_ALLOCA takes
NegSizeReg as input and returns
FinalStackPtr. FinalStackPtr=StackPtr+ActualNegSize is calculated
correctly, however code following PREPARE_PROBED_ALLOCA still uses
value of NegSizeReg, which does not contain ActualNegSize if
MaxAlign > TargetAlign, to calculate loop trip count and residual
number of bytes.

This patch is part of fix of
https://bugs.llvm.org/show_bug.cgi?id=46759.

Differential Revision: https://reviews.llvm.org/D84152