[PATCH] D61159: [SimplifyCFG] Run ReduceSwitchRange unconditionally, generalize

James Molloy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 01:10:59 PDT 2019


jmolloy added a comment.

Thanks for the changes, just two comments!



================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:5445
     StringRef FuncName = Fn->getName();
-    SwitchLookupTable Table(Mod, TableSize, MinCaseVal, ResultList, DV, DL,
-                            FuncName);
+    SwitchLookupTable Table(Mod, TableSize, NeedMask ? MinCaseVal :
+      ConstantInt::get(MinCaseVal->getContext(), APInt(CaseSize, 0)),
----------------
This line is too complex. Please don't nest conditionals into function calls; use an extra line to set up the constant.


================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:5530
+  unsigned BestIndex = 0;
+  for (unsigned I = 1;I != Values.size();I++) {
+    if (Values[I] - Values[I-1] > BestDistance) {
----------------
Space after both ;'s.

The best way to do this is use git-clang-format, which I've recommended before.


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

https://reviews.llvm.org/D61159





More information about the llvm-commits mailing list