[PowerPC] Don't do the folding if the operand is R0/X0
authorQingShan Zhang <qshanz@cn.ibm.com>
Tue, 31 Mar 2020 02:47:14 +0000 (02:47 +0000)
committerQingShan Zhang <qshanz@cn.ibm.com>
Tue, 31 Mar 2020 02:50:19 +0000 (02:50 +0000)
commit4eeb56d08874e1abe46d7f6d1dd492e717b93a35
tree949d54f341dfbe71816c35d26c09607e91c7a958
parent3f5a5dd295f5655c34feff829b0fd61ab1143710
[PowerPC] Don't do the folding if the operand is R0/X0

We have this transformation in PowerPC peephole:

Replace instruction:
  renamable $x28 = ADDI8 renamable $x7, -8
  renamable $x28 = ADD8 killed renamable $x28, renamable $x0
  STFD killed renamable $f0, -8, killed renamable $x28 :: (store 8 into %ir._ind_cast99.epil)
with:
  renamable $x28 = ADDI8 renamable $x7, -16
  STFDX killed renamable $f0, $x0, killed $x28 :: (store 8 into %ir._ind_cast99.epil)

It is invalid as the '$x0' in STFDX is constant 0, not register r0.

Reviewed By: Nemanjai

Differential Revision: https://reviews.llvm.org/D77034
llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
llvm/test/CodeGen/PowerPC/fold-frame-offset-using-rr.mir