@@ -359,17 +359,16 @@ class OpLowerer {
359359 return lowerToBindAndAnnotateHandle (F);
360360 }
361361
362- Error replaceSplitDoubleCallUsages (CallInst *Intrin, CallInst *Op) {
362+ Error replaceExtractElementTypeOfCallUsages (CallInst *Intrin, CallInst *Op) {
363363 for (Use &U : make_early_inc_range (Intrin->uses ())) {
364364 if (auto *EVI = dyn_cast<ExtractValueInst>(U.getUser ())) {
365365
366366 if (EVI->getNumIndices () != 1 )
367- return createStringError (std::errc::invalid_argument,
368- " Splitdouble has only 2 elements" );
367+ return createStringError (std::errc::invalid_argument, (std::string (Intrin->getOpcodeName ()) + " has only 2 elements" ).c_str ());
369368 EVI->setOperand (0 , Op);
370369 } else {
371370 return make_error<StringError>(
372- " Splitdouble use is not ExtractValueInst" ,
371+ ( std::string (Intrin-> getOpcodeName ()) + " use is not ExtractValueInst" ). c_str () ,
373372 inconvertibleErrorCode ());
374373 }
375374 }
@@ -821,7 +820,17 @@ class OpLowerer {
821820 F, OpCode::SplitDouble,
822821 OpBuilder.getSplitDoubleType (M.getContext ()),
823822 [&](CallInst *CI, CallInst *Op) {
824- return replaceSplitDoubleCallUsages (CI, Op);
823+ return replaceExtractElementTypeOfCallUsages (CI, Op);
824+ });
825+ break ;
826+ // TODO: this can be removed when
827+ // https://github.com/llvm/llvm-project/issues/113192 is fixed
828+ case Intrinsic::uadd_with_overflow:
829+ HasErrors |= replaceFunctionWithNamedStructOp (
830+ F, OpCode::UAddc,
831+ OpBuilder.getBinaryWithCarryType (M.getContext ()),
832+ [&](CallInst *CI, CallInst *Op) {
833+ return replaceExtractElementTypeOfCallUsages (CI, Op);
825834 });
826835 break ;
827836 case Intrinsic::ctpop:
0 commit comments