[llvm] r350379 - [WebAssembly] Split the checking from the sorting logic.
Richard Trieu via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 3 22:49:24 PST 2019
Author: rtrieu
Date: Thu Jan 3 22:49:24 2019
New Revision: 350379
URL: http://llvm.org/viewvc/llvm-project?rev=350379&view=rev
Log:
[WebAssembly] Split the checking from the sorting logic.
Move the check for -1 and identical values outside the vector sorting code.
Compare functions need to be able to compare identical elements to be
conforming.
Modified:
llvm/trunk/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp?rev=350379&r1=350378&r2=350379&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp Thu Jan 3 22:49:24 2019
@@ -250,11 +250,22 @@ bool LoopFixer::run() {
[&](const MachineBasicBlock *A, const MachineBasicBlock *B) {
auto ANum = A->getNumber();
auto BNum = B->getNumber();
- assert(ANum != -1 && BNum != -1);
- assert(ANum != BNum);
return ANum < BNum;
});
+#ifndef NDEBUG
+ for (auto Block : SortedEntries)
+ assert(Block->getNumber() != -1);
+ if (SortedEntries.size() > 1) {
+ for (auto I = SortedEntries.begin(), E = SortedEntries.end() - 1;
+ I != E; ++I) {
+ auto ANum = (*I)->getNumber();
+ auto BNum = (*(std::next(I)))->getNumber();
+ assert(ANum != BNum);
+ }
+ }
+#endif
+
// Create a dispatch block which will contain a jump table to the entries.
MachineBasicBlock *Dispatch = MF.CreateMachineBasicBlock();
MF.insert(MF.end(), Dispatch);
More information about the llvm-commits
mailing list