[PATCH] D40892: Add early out to O(n^2) switch analysis in switch-to-select conversion
Andrew Scheidecker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 6 05:23:12 PST 2017
AndrewScheidecker updated this revision to Diff 125717.
AndrewScheidecker added a comment.
Include full context in diff, as suggested on IRC
Repository:
rL LLVM
https://reviews.llvm.org/D40892
Files:
lib/Transforms/Utils/SimplifyCFG.cpp
Index: lib/Transforms/Utils/SimplifyCFG.cpp
===================================================================
--- lib/Transforms/Utils/SimplifyCFG.cpp
+++ lib/Transforms/Utils/SimplifyCFG.cpp
@@ -4720,6 +4720,15 @@
return false;
MapCaseToResult(CaseVal, UniqueResults, Results.begin()->second);
+ // No more than two unique results can be selected between.
+ if (UniqueResults.size() > 2)
+ return false;
+
+ // No result may have more than one case that selects it.
+ for(const auto &RI : UniqueResults)
+ if (RI.second.size() > 1)
+ return false;
+
// Check the PHI consistency.
if (!PHI)
PHI = Results[0].first;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40892.125717.patch
Type: text/x-patch
Size: 677 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171206/d77ef32c/attachment.bin>
More information about the llvm-commits
mailing list