[libc-commits] [lldb] [mlir] [openmp] [libc] [clang] [libcxx] [flang] [llvm] [clang-tools-extra] GlobalISel: Guard return in llvm::getIConstantSplatVal (PR #71989)

via libc-commits libc-commits at lists.llvm.org
Wed Nov 15 05:02:23 PST 2023


================
@@ -1116,9 +1116,9 @@ std::optional<APInt>
 llvm::getIConstantSplatVal(const Register Reg, const MachineRegisterInfo &MRI) {
   if (auto SplatValAndReg =
           getAnyConstantSplat(Reg, MRI, /* AllowUndef */ false)) {
-    std::optional<ValueAndVReg> ValAndVReg =
-        getIConstantVRegValWithLookThrough(SplatValAndReg->VReg, MRI);
-    return ValAndVReg->Value;
+    if (std::optional<ValueAndVReg> ValAndVReg =
----------------
qcolombet wrote:

@changpeng 
A comment here would be nice.
E.g., "Even if the value is a splat constant, it may not be an integer one."

https://github.com/llvm/llvm-project/pull/71989


More information about the libc-commits mailing list