From 86592d2f7ae8b0fe94ce766677bdb2d19ad9a214 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sun, 31 Jan 2021 20:31:24 -0800 Subject: [PATCH] [TableGen] Don't commute isel patterns if it would put an immAllOnesV or immAllZerosV on the left hand side. This primarily occurs with isel patterns using vnot. This reduces the number of variants in the isel tables. We generally canonicalize build_vectors of constants to the RHS. I think we might fail if there is a bitcast on the build_vector, but that should be easy to fix if we can find a case. Usually the bitcast is introduced by type legalization or lowering. It's likely canonicalization would have already occured. --- utils/TableGen/CodeGenDAGPatterns.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp index 52c47f5e514..01a6335a163 100644 --- a/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/utils/TableGen/CodeGenDAGPatterns.cpp @@ -2637,6 +2637,8 @@ static bool OnlyOnRHSOfCommutative(TreePatternNode *N) { return true; if (N->isLeaf() && isa(N->getLeafValue())) return true; + if (isImmAllOnesAllZerosMatch(N)) + return true; return false; }