diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index 4a8bc3177c85..775287ea0960 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -8491,7 +8491,9 @@ struct NodeExtensionHelper { } /// Check if this operand is compatible with the given vector length \p VL. - bool isVLCompatible(SDValue VL) const { return this->VL && this->VL == VL; } + bool isVLCompatible(SDValue VL) const { + return this->VL != SDValue() && this->VL == VL; + } /// Check if this operand is compatible with the given \p Mask. bool isMaskCompatible(SDValue Mask) const {