[GlobalIsel] Fix undefined behavior if Action not set (release), it aslo crashing in debug mode.

Differential Revision: https://reviews.llvm.org/D34978

llvm-svn: 311272
This commit is contained in:
Igor Breger 2017-08-20 06:26:22 +00:00
parent b0c9753691
commit d88dfd32f8
1 changed files with 3 additions and 0 deletions

View File

@ -162,6 +162,9 @@ public:
/// on Ty until we find a legal type for this operation.
Optional<LLT> findLegalizableSize(const InstrAspect &Aspect,
function_ref<LLT(LLT)> 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;