[PATCH] D33694: [PartialInlining] : Partial inlining Overhead reduction: eliminate unnecessary live-out(s)
Davide Italiano via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 31 16:21:18 PDT 2017
davide accepted this revision.
davide added inline comments.
================
Comment at: lib/Transforms/IPO/PartialInlining.cpp:660-670
+ Value *CommonValue = nullptr;
+ for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
+ Value *PhiOpnd = PN->getIncomingValue(i);
+ if (!CommonValue)
+ CommonValue = PhiOpnd;
+ else if (CommonValue != PhiOpnd) {
+ CommonValue = nullptr;
----------------
wmi wrote:
> Maybe a little bit simpler to use find_if, but I am not sure.
>
> ```
> if (find_if(PN->incoming_values(), std::bind2nd(std::not_equal_to<Value *>(), PN->getIncomingValue(0)))
> != PN->incoming_values().end())
> return (Value *)nullptr;
> return PN->getIncomingValue(0);
> ```
>
I don't think the `find_if` version is more readable, but that's just my opinion.
https://reviews.llvm.org/D33694
More information about the llvm-commits
mailing list