[all-commits] [llvm/llvm-project] 891225: [PowerPC] Fix wrong codegen when stack pointer has...

bzEq via All-commits all-commits at lists.llvm.org
Tue Jul 21 23:35:52 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8912252252c87d8ef6623ecf9fdde444560ee4b9
      https://github.com/llvm/llvm-project/commit/8912252252c87d8ef6623ecf9fdde444560ee4b9
  Author: Kai Luo <lkail at cn.ibm.com>
  Date:   2020-07-22 (Wed, 22 Jul 2020)

  Changed paths:
    M llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
    M llvm/test/CodeGen/PowerPC/pr46759.ll

  Log Message:
  -----------
  [PowerPC] Fix wrong codegen when stack pointer has to realign in prologue

Current powerpc backend generates wrong code sequence if stack pointer
has to realign if -fstack-clash-protection enabled. When probing in
prologue, backend should generate a subtraction instruction rather
than a `stux` instruction to realign the stack pointer.

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

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


  Commit: c3f9697f1f227296818fbaf1a770a29842ea454c
      https://github.com/llvm/llvm-project/commit/c3f9697f1f227296818fbaf1a770a29842ea454c
  Author: Kai Luo <lkail at cn.ibm.com>
  Date:   2020-07-22 (Wed, 22 Jul 2020)

  Changed paths:
    M llvm/lib/Target/PowerPC/PPCISelLowering.cpp
    M llvm/lib/Target/PowerPC/PPCInstr64Bit.td
    M llvm/lib/Target/PowerPC/PPCInstrInfo.td
    M llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
    M llvm/test/CodeGen/PowerPC/pr46759.ll
    M llvm/test/CodeGen/PowerPC/stack-clash-dynamic-alloca.ll

  Log Message:
  -----------
  [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


Compare: https://github.com/llvm/llvm-project/compare/e9f5ca0b7977...c3f9697f1f22


More information about the All-commits mailing list