[PATCH] D34978: [GlobalIsel] fix undefined behavior if Action not set.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 19 23:27:25 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL311272: [GlobalIsel] Fix undefined behavior if Action not set (release), it aslo… (authored by ibreger).

Repository:
  rL LLVM

https://reviews.llvm.org/D34978

Files:
  llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h


Index: llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
===================================================================
--- llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
@@ -162,6 +162,9 @@
   /// 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34978.111863.patch
Type: text/x-patch
Size: 695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170820/ab673065/attachment.bin>


More information about the llvm-commits mailing list