[PATCH] D42637: [PowerPC] Check hot loop exit edge in PPCCTRLoops

Hiroshi Inoue via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 31 20:51:22 PST 2018


inouehrs marked 2 inline comments as done.
inouehrs added a comment.

> This seems like a good thing to do. Would you be able to provide some benchmark data to show the impact?

In a micro benchmark with a small loop always exit at the first iteration due to a hot exit branch, this patch gives about 20% performance improvements. I am testing SPEC benchmarks with PGO.



================
Comment at: lib/Target/PowerPC/PPCCTRLoops.cpp:533
+  // we should not transform this loop.
+  for (SmallVectorImpl<BasicBlock *>::iterator I = ExitingBlocks.begin(),
+       IE = ExitingBlocks.end(); I != IE; ++I) {
----------------
nemanjai wrote:
> Is there a reason this isn't a range for loop? Also, we typically use `I` for instructions or iterators over them. Seems like `BB` might be a clearer name here.
Thanks. This is much clearer.
I used iterator to be consistent with other loops in this method.



================
Comment at: test/CodeGen/PowerPC/ctrloops-hot-exit.ll:23
+  %tobool = icmp eq i32 %1, 0
+  br i1 %tobool, label %if.end, label %cleanup, !prof !1
+
----------------
nemanjai wrote:
> Is it possible to also construct a test case where the true branch is the exit branch?
I added variations where the true branch is for the exit branch.


https://reviews.llvm.org/D42637





More information about the llvm-commits mailing list