[PATCH] D35584: [CGP] Fold empty dedicated exit blocks created by loopsimplify.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 28 14:55:19 PDT 2017


efriedma added inline comments.


================
Comment at: test/Transforms/CodeGenPrepare/merge-empty-latch-block.ll:66
+    i32 47, label %for.cond.backedge.loopexit
+  ]
+
----------------
Probably not relevant, but it looks like there's a missed optimization here: we should rotate this loop.


================
Comment at: test/Transforms/CodeGenPrepare/merge-empty-latch-block.ll:91
+while.body.backedge.loopexit:                     ; preds = %while.cond5
+  br label %while.body.backedge
+
----------------
If I'm following correctly, the problem is this block: you want it to go away, but cgp isn't folding it.

It looks like isMergingEmptyBlockProfitable is specifically trying to detect cases like this: folding away this BB involves inserting an extra COPY into the while.cond5, and while.cond5 is hotter than while.body.backedge.loopexit, so in theory you could lose performance.

In this particular situation, though, you want to fold it anyway?  What distinguishes this testcase from the testcase in r289988?


https://reviews.llvm.org/D35584





More information about the llvm-commits mailing list