[PATCH] D151848: [X86, Peephole] Enable FoldImmediate for X86
Guozhi Wei via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 31 20:52:29 PDT 2023
Carrot added inline comments.
================
Comment at: llvm/lib/CodeGen/PeepholeOptimizer.cpp:1391
+ // FoldImmediate can delete ImmDefMI if MI was its only user. If ImmDefMI
+ // is not deleted, and we happenly get a same MI, we can delete MI and
+ // replace its users.
----------------
craig.topper wrote:
> Carrot wrote:
> > craig.topper wrote:
> > > happenly?
> > The case I encountered is
> > ```
> > %1 = MOV32ri 4
> > %2 = COPY %1
> > // other uses of %1
> > ...
> > ```
> > After FoldImmediate it becomes
> > ```
> > %1 = MOV32ri 4
> > %2 = MOV32ri 4
> > ```
> > Becuase %1 has multiple uses, so it can't be deleted by FoldImmediate. These two instructions are identical now, so we can replace the uses of %2 by %1, and delete the definition of %2.
> I was questioning whether "happenly" is a real word.
Sorry for my poor English. It should be happened.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151848/new/
https://reviews.llvm.org/D151848
More information about the llvm-commits
mailing list