[PATCH] D33144: [RegisterBankInfo] Remove overly-agressive asserts

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 12 12:45:08 PDT 2017


tstellar updated this revision to Diff 98819.
tstellar added a comment.

Add early exit to avoid overflow.


https://reviews.llvm.org/D33144

Files:
  lib/CodeGen/GlobalISel/RegBankSelect.cpp


Index: lib/CodeGen/GlobalISel/RegBankSelect.cpp
===================================================================
--- lib/CodeGen/GlobalISel/RegBankSelect.cpp
+++ lib/CodeGen/GlobalISel/RegBankSelect.cpp
@@ -204,12 +204,8 @@
     // TODO: use a dedicated constant for ImpossibleCost.
     if (Cost != UINT_MAX)
       return Cost;
-    assert(!TPC->isGlobalISelAbortEnabled() &&
-           "Legalization not available yet");
     // Return the legalization cost of that repairing.
   }
-  assert(!TPC->isGlobalISelAbortEnabled() &&
-         "Complex repairing not implemented yet");
   return UINT_MAX;
 }
 
@@ -450,6 +446,9 @@
 
     // Sums up the repairing cost of MO at each insertion point.
     uint64_t RepairCost = getRepairCost(MO, ValMapping);
+    if (RepairCost == UINT_MAX)
+      continue;
+
     // Bias used for splitting: 5%.
     const uint64_t PercentageForBias = 5;
     uint64_t Bias = (RepairCost * PercentageForBias + 99) / 100;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33144.98819.patch
Type: text/x-patch
Size: 956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170512/0c6568bf/attachment.bin>


More information about the llvm-commits mailing list