From 90be0d800b350da12689c7943800e18420149eaa Mon Sep 17 00:00:00 2001
From: Kaj Tuomi <kaj.tuomi@siru.fi>
Date: Thu, 12 Oct 2017 13:05:10 +0300
Subject: [PATCH] Fix input vector for reduce cells.

---
 passes/opt/opt_reduce.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/passes/opt/opt_reduce.cc b/passes/opt/opt_reduce.cc
index eb9d02ad5..10bdf7221 100644
--- a/passes/opt/opt_reduce.cc
+++ b/passes/opt/opt_reduce.cc
@@ -88,6 +88,7 @@ struct OptReduceWorker
 		RTLIL::SigSpec new_sig_a(new_sig_a_bits);
 
 		if (new_sig_a != sig_a || sig_a.size() != cell->getPort("\\A").size()) {
+			new_sig_a.sort_and_unify();
 			log("    New input vector for %s cell %s: %s\n", cell->type.c_str(), cell->name.c_str(), log_signal(new_sig_a));
 			did_something = true;
 			total_count++;