From a332c3d024c02b961ea975dcebcb99335583bc52 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 23 Apr 2017 11:55:14 -0700 Subject: [PATCH] Make sure that encodings has entries for all instructions after legalize(). If we generated new instructions as part of legalize, and the new instructions failed to legalize, we'd be left with a func.encodings[] that would panic when you dereferenced the inst. --- lib/cretonne/src/legalizer/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cretonne/src/legalizer/mod.rs b/lib/cretonne/src/legalizer/mod.rs index 50300027a2..edd233ccee 100644 --- a/lib/cretonne/src/legalizer/mod.rs +++ b/lib/cretonne/src/legalizer/mod.rs @@ -100,6 +100,7 @@ pub fn legalize_function(func: &mut Function, cfg: &mut ControlFlowGraph, isa: & prev_pos = pos.position(); } } + func.encodings.resize(func.dfg.num_insts()); } // Include legalization patterns that were generated by `gen_legalizer.py` from the `XForms` in