[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:35:10 PDT 2022
DavidSpickett updated this revision to Diff 450262.
DavidSpickett added a comment.
Use early return.
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.450262.patch
Type: text/x-patch
Size: 837 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220805/b127bfb3/attachment.bin>
More information about the llvm-commits
mailing list