[llvm] r311272 - [GlobalIsel] Fix undefined behavior if Action not set (release), it aslo crashing in debug mode.
Igor Breger via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 19 23:26:22 PDT 2017
Author: ibreger
Date: Sat Aug 19 23:26:22 2017
New Revision: 311272
URL: http://llvm.org/viewvc/llvm-project?rev=311272&view=rev
Log:
[GlobalIsel] Fix undefined behavior if Action not set (release), it aslo crashing in debug mode.
Differential Revision: https://reviews.llvm.org/D34978
Modified:
llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
Modified: llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h?rev=311272&r1=311271&r2=311272&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h Sat Aug 19 23:26:22 2017
@@ -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;
More information about the llvm-commits
mailing list