[PATCH] D131873: [PowerPC] Optimize compare by using record form in post-RA.

Kai Luo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 2 00:20:04 PDT 2022


lkail added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:2821
+  // Fix up killed/dead flag after transformation.
+  if (IsFwdFeederRegKilled || RegMO.isKill())
+    fixupIsDeadOrKill(SrcMI, &CmpMI, CRReg);
----------------
lkail wrote:
> shchenz wrote:
> > `RegMO` is the def of CmpMI, it will not have kill flag. And CR0 will be be killed between SrcMI and CmpMI, otherwise we can not do the transformation. No use of CR0 should exist between SrcMI and CmpMI.
> > 
> > Here I think we should handle the killed flag for `SrcReg` if it is killed in CmpMI and there is other use between SrcMI and CmpMI? 
> > Here I think we should handle the killed flag for SrcReg if it is killed in CmpMI and there is other use between SrcMI and CmpMI?
> 
> Look no need. We are folding
> ```
> L1: a = op1 b, c
> ...
> L2: b = op2 a, 0
> ```
> ->
> ```
> L1: a, b = op3 b, c
> ...
> ```
> The constraint here is b can't be def/use between [L1,L2). Use of `a` between [L1, L2] is still the version defined at L1. And call of `getDefMIPostRA` should guarantee L1 is the nearest point defined `a`.
edit:
```
L1: a = op1 b, c
...
L2: d = op2 a, 0
```
->
```
L1: a, d = op3 b, c
...
```
The constraint here is `d` can't be def/use between [L1,L2).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131873/new/

https://reviews.llvm.org/D131873



More information about the llvm-commits mailing list