[PATCH] D104410: GlobalISel/Utils: Refactor constant splat match functions
Jessica Paquette via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 17 10:34:38 PDT 2021
paquette added inline comments.
================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h:111
+ return true;
+ return false;
+ };
----------------
Could this function be a one-liner?
`return getFConstantSplat(Reg, MRI) || getFConstantVRegValWithLookThrough(Reg, MRI);`
================
Comment at: llvm/lib/CodeGen/GlobalISel/Utils.cpp:933
+ bool AllowUndef) {
+ MachineInstr *MI = getDefIgnoringCopies(VReg, MRI);
+
----------------
check that this is not nullptr?
================
Comment at: llvm/lib/CodeGen/GlobalISel/Utils.cpp:939
+ Optional<ValueAndVReg> SplatValAndReg = None;
+ for (unsigned i = 1, NumOps = MI->getNumOperands(); i != NumOps; ++i) {
+
----------------
Maybe use
```
for (MachineOperand &Op : MI->uses()) {
...
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104410/new/
https://reviews.llvm.org/D104410
More information about the llvm-commits
mailing list