[PATCH] D52558: [PHIElimination] Lower a PHI node with only undef uses as IMPLICIT_DEF

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 27 09:31:27 PDT 2018


MatzeB added inline comments.


================
Comment at: lib/CodeGen/PHIElimination.cpp:225
+/// Return true if all sources of the phi node are implicit_def's, or undef's.
+static bool isSourceUndefined(const MachineInstr *MPhi,
+                              const MachineRegisterInfo *MRI) {
----------------
MatzeB wrote:
> If we touch this function anyway, should we take the opportunity to switch to a more modern style:
> ```
> static bool isSourceUndefined(const MachineInstr &MPhi,
>                               const MachineRegisterInfo &MRI) {
>   for (unsigned I = 1, E = MPhi->getNumOperands(); I != E; I += 2) {
>     const MachineOperand &MO = MPhi->getOperand(I);
>     if (!isImplicitlyDefined(MO.getReg(), MRI) && !MO.isUndef())
>       return false;
>   }
>   return true;
> }
> ```
how about naming this `allPhiOperandsUndefined`?


Repository:
  rL LLVM

https://reviews.llvm.org/D52558





More information about the llvm-commits mailing list