diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h --- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h +++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h @@ -573,7 +573,7 @@ class ComponentProps { private: unsigned SrcOperandsNum = 0; - std::optional MandatoryLiteralIdx; + unsigned MandatoryLiteralIdx = ~0u; bool HasSrc2Acc = false; public: @@ -589,13 +589,13 @@ } // Return true iif this component has a mandatory literal. - bool hasMandatoryLiteral() const { return MandatoryLiteralIdx.has_value(); } + bool hasMandatoryLiteral() const { return MandatoryLiteralIdx != ~0u; } // If this component has a mandatory literal, return component operand // index of this literal (i.e. either Component::SRC1 or Component::SRC2). unsigned getMandatoryLiteralCompOperandIndex() const { assert(hasMandatoryLiteral()); - return *MandatoryLiteralIdx; + return MandatoryLiteralIdx; } // Return true iif this component has operand @@ -611,8 +611,7 @@ private: bool hasMandatoryLiteralAt(unsigned CompSrcIdx) const { assert(CompSrcIdx < Component::MAX_SRC_NUM); - return hasMandatoryLiteral() && - *MandatoryLiteralIdx == Component::DST_NUM + CompSrcIdx; + return MandatoryLiteralIdx == Component::DST_NUM + CompSrcIdx; } };