[PATCH] D21291: [SimplifyCFG] Range reduce switches
silviu.baranga@arm.com via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 13 08:51:26 PDT 2016
sbaranga added inline comments.
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:4993
@@ +4992,3 @@
+ bool HasHoles = Values.back() != SI->getNumCases() - 1;
+ if (!HasHoles)
+ // This switch is already dense.
----------------
Could you also add a test for this case?
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:5009
@@ +5008,3 @@
+ // We can range-reduce this switch (X) to switch (X - Base) / GCD.
+ // This should be profitable if the resulting switch has no holes -
+ // this should result in a better lowering.
----------------
If it doesn't have holes then the GCD that you are looking for should be Values[1].
Repository:
rL LLVM
http://reviews.llvm.org/D21291
More information about the llvm-commits
mailing list