File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -2023,7 +2023,10 @@ Expected<RuleMatcher> GlobalISelEmitter::runOnPattern(const PatternToMatch &P) {
20232023 auto &DstI = Target.getInstruction (DstOp);
20242024 StringRef DstIName = DstI.TheDef ->getName ();
20252025
2026- unsigned DstNumDefs = DstI.Operands .NumDefs ,
2026+ // Count both implicit and explicit defs in the dst instruction.
2027+ // This avoids errors importing patterns that have inherent implicit defs.
2028+ unsigned DstExpDefs = DstI.Operands .NumDefs ,
2029+ DstNumDefs = DstI.ImplicitDefs .size () + DstExpDefs,
20272030 SrcNumDefs = Src.getExtTypes ().size ();
20282031 if (DstNumDefs < SrcNumDefs) {
20292032 if (DstNumDefs != 0 )
@@ -2045,7 +2048,7 @@ Expected<RuleMatcher> GlobalISelEmitter::runOnPattern(const PatternToMatch &P) {
20452048 // The root of the match also has constraints on the register bank so that it
20462049 // matches the result instruction.
20472050 unsigned OpIdx = 0 ;
2048- unsigned N = std::min (DstNumDefs , SrcNumDefs);
2051+ unsigned N = std::min (DstExpDefs , SrcNumDefs);
20492052 for (unsigned I = 0 ; I < N; ++I) {
20502053 const TypeSetByHwMode &VTy = Src.getExtType (I);
20512054
You can’t perform that action at this time.
0 commit comments