Index: include/llvm/CodeGen/GlobalISel/LegalizerInfo.h =================================================================== --- include/llvm/CodeGen/GlobalISel/LegalizerInfo.h +++ include/llvm/CodeGen/GlobalISel/LegalizerInfo.h @@ -162,6 +162,9 @@ /// on Ty until we find a legal type for this operation. Optional findLegalizableSize(const InstrAspect &Aspect, function_ref NextType) const { + if (Aspect.Idx >= Actions[Aspect.Opcode - FirstOp].size()) + return None; + LegalizeAction Action; const TypeMap &Map = Actions[Aspect.Opcode - FirstOp][Aspect.Idx]; LLT Ty = Aspect.Type;