[PATCH] D155711: [SimplifyCFG] Hoist common instructions on Switch.

Hongyu Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 29 11:02:58 PDT 2023


XChy added a comment.

Nice work to me! Just some nits here.
Can you create two patches to better show the difference before/after transform? 
The first patch includes your unoptimized testcases without the fold. (Your first commit)
The second patch includes your optimized testcases and your code for the fold. (Your second commit, which is based on your first commit)
And then let the first patch be the parent revision of the second patch through "Edit Related Revisions".



================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1544
+  for (auto *Succ : successors(BB)) {
+    if (Succ->hasAddressTaken() || !Succ->getSinglePredecessor()) {
+      return false;
----------------
Omit the braces of single-statement if/for.


================
Comment at: llvm/test/Transforms/SimplifyCFG/hoist-common-code.ll:97
+  ret i1 %result
+}
----------------
More positive/negative tests are needed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155711



More information about the llvm-commits mailing list