[PATCH] D104410: GlobalISel/Utils: Add util function and matcher for constant splat

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 17 02:07:10 PDT 2021


foad added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/Utils.h:339
+/// When \p AllowUndef == true some elements can be undef but not all.
+Optional<Register> getVectorConstantSplatUndef(Register VReg,
+                                               const MachineRegisterInfo &MRI,
----------------
Would a return type of Optional<ValueAndVReg> (like getConstantVRegValWithLookThrough) be more useful? Actually I'm not sure if returning the register is useful, maybe just Optional<APInt>?


================
Comment at: llvm/lib/CodeGen/GlobalISel/Utils.cpp:944
+    bool MatchFConstant, bool MatchIConstant) {
+  // Look through copies.
+  MachineInstr *MI;
----------------
Isn't there an existing utility you can call to do this?


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

https://reviews.llvm.org/D104410



More information about the llvm-commits mailing list