[PATCH] D130230: [llvm][IROutliner] Account for return void in sort comparator

David Spickett via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 5 02:36:51 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc401dbde71fd: [llvm][IROutliner] Account for return void in sort comparator (authored by DavidSpickett).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130230/new/

https://reviews.llvm.org/D130230

Files:
  llvm/lib/Transforms/IPO/IROutliner.cpp


Index: llvm/lib/Transforms/IPO/IROutliner.cpp
===================================================================
--- llvm/lib/Transforms/IPO/IROutliner.cpp
+++ llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -169,7 +169,15 @@
   for (auto &VtoBB : Map)
     SortedKeys.push_back(VtoBB.first);
 
+  // Here we expect to have either 1 value that is void (nullptr) or multiple
+  // values that are all constant integers.
+  if (SortedKeys.size() == 1) {
+    assert(!SortedKeys[0] && "Expected a single void value.");
+    return;
+  }
+
   stable_sort(SortedKeys, [](const Value *LHS, const Value *RHS) {
+    assert(LHS && RHS && "Expected non void values.");
     const ConstantInt *LHSC = dyn_cast<ConstantInt>(LHS);
     const ConstantInt *RHSC = dyn_cast<ConstantInt>(RHS);
     assert(RHSC && "Not a constant integer in return value?");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130230.450263.patch
Type: text/x-patch
Size: 837 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220805/722a213d/attachment.bin>


More information about the llvm-commits mailing list