@@ -2704,7 +2704,8 @@ EmitAsmStores(CodeGenFunction &CGF, const AsmStmt &S,
27042704 const llvm::ArrayRef<LValue> ResultRegDests,
27052705 const llvm::ArrayRef<QualType> ResultRegQualTys,
27062706 const llvm::BitVector &ResultTypeRequiresCast,
2707- const std::vector<unsigned > &OutputOperandBounds) {
2707+ const std::vector<std::optional<std::pair<unsigned , unsigned >>>
2708+ &OutputOperandBounds) {
27082709 CGBuilderTy &Builder = CGF.Builder ;
27092710 CodeGenModule &CGM = CGF.CGM ;
27102711 llvm::LLVMContext &CTX = CGF.getLLVMContext ();
@@ -2721,12 +2722,10 @@ EmitAsmStores(CodeGenFunction &CGF, const AsmStmt &S,
27212722 llvm::Value *Tmp = RegResults[i];
27222723 llvm::Type *TruncTy = ResultTruncRegTypes[i];
27232724
2724- if ((i < OutputOperandBounds.size ()) && OutputOperandBounds[i]) {
2725- // Target must guarantee the Value `Tmp` here is lowered to a boolean
2726- // value.
2727- // Lowering 'Tmp' as - 'icmp ult %Tmp , CCUpperBound'.
2728- unsigned UpperBound = OutputOperandBounds[i];
2729- assert (UpperBound <= 4 && " Output operand out of range!" );
2725+ if ((i < OutputOperandBounds.size ()) &&
2726+ OutputOperandBounds[i].has_value ()) {
2727+ const auto [LowerBound, UpperBound] = OutputOperandBounds[i].value ();
2728+ assert (LowerBound == 0 && " Output operand lower bound is not zero." );
27302729 llvm::Constant *UpperBoundConst =
27312730 llvm::ConstantInt::get (Tmp->getType (), UpperBound);
27322731 llvm::Value *IsBooleanValue =
@@ -2859,7 +2858,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
28592858 std::vector<llvm::Type *> ArgElemTypes;
28602859 std::vector<llvm::Value*> Args;
28612860 llvm::BitVector ResultTypeRequiresCast;
2862- std::vector<unsigned > OutputOperandBounds;
2861+ std::vector<std::optional<std::pair< unsigned , unsigned >> > OutputOperandBounds;
28632862
28642863 // Keep track of inout constraints.
28652864 std::string InOutConstraints;
@@ -2917,8 +2916,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
29172916 ResultRegQualTys.push_back (QTy);
29182917 ResultRegDests.push_back (Dest);
29192918
2920- const auto [_, UpperBound] = Info.getOutputOperandBounds ();
2921- OutputOperandBounds.push_back (UpperBound);
2919+ OutputOperandBounds.emplace_back (Info.getOutputOperandBounds ());
29222920
29232921 llvm::Type *Ty = ConvertTypeForMem (QTy);
29242922 const bool RequiresCast = Info.allowsRegister () &&
0 commit comments