[llvm] 6b44631 - [TableGen] Predicate::operator== needs to compare the HwMode feature name in addition to the HwMode flag.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 16 13:22:48 PDT 2021


Author: Craig Topper
Date: 2021-04-16T13:22:28-07:00
New Revision: 6b446310bef95eecea7afdd989e57e64d39a3b0d

URL: https://github.com/llvm/llvm-project/commit/6b446310bef95eecea7afdd989e57e64d39a3b0d
DIFF: https://github.com/llvm/llvm-project/commit/6b446310bef95eecea7afdd989e57e64d39a3b0d.diff

LOG: [TableGen] Predicate::operator== needs to compare the HwMode feature name in addition to the HwMode flag.

This was causing GenerateVariants to lose some variants since
HwMode is expanded first. We were mistakenly thinking the HwMode
predicate matched and finding the variant was isomorphic to a
pattern in another HwMode and discarding it.

Found while investigating it if would be better to generate
variants before expanding HwModes to improve RISCV build time.
I noticed an increase in the number of Opc_MorphNodeTo in the table
which indicated that the number of patterns had changed.

Added: 
    

Modified: 
    llvm/utils/TableGen/CodeGenDAGPatterns.h

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/CodeGenDAGPatterns.h b/llvm/utils/TableGen/CodeGenDAGPatterns.h
index d0cf18b7c4c7..20b27bc7c7a7 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.h
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.h
@@ -1078,7 +1078,8 @@ class Predicate {
   }
 
   bool operator==(const Predicate &P) const {
-    return IfCond == P.IfCond && IsHwMode == P.IsHwMode && Def == P.Def;
+    return IfCond == P.IfCond && IsHwMode == P.IsHwMode && Def == P.Def &&
+           Features == P.Features;
   }
   bool operator<(const Predicate &P) const {
     if (IsHwMode != P.IsHwMode)


        


More information about the llvm-commits mailing list