[TableGen] Early exit from ExpandHwModeBasedTypes when there are no HwModes.
authorCraig Topper <craig.topper@sifive.com>
Sat, 22 Apr 2023 00:27:06 +0000 (17:27 -0700)
committerCraig Topper <craig.topper@sifive.com>
Sat, 22 Apr 2023 00:27:25 +0000 (17:27 -0700)
Most targets don't use HwModes. For these targets we can skip
collecting the HwModes and copying all the pattern pointers.

llvm/utils/TableGen/CodeGenDAGPatterns.cpp

index f861caa..2d8b52c 100644 (file)
@@ -4381,6 +4381,9 @@ static void collectModes(std::set<unsigned> &Modes, const TreePatternNode *N) {
 
 void CodeGenDAGPatterns::ExpandHwModeBasedTypes() {
   const CodeGenHwModes &CGH = getTargetInfo().getHwModes();
+  if (CGH.getNumModeIds() == 1)
+    return;
+
   std::vector<PatternToMatch> Copy;
   PatternsToMatch.swap(Copy);