[PATCH] D76923: [NFC] Improve performances of Value::getSingleUndroppableUse

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 28 08:04:10 PDT 2020


nikic added a comment.

In D76923#1947854 <https://reviews.llvm.org/D76923#1947854>, @Tyker wrote:

> In D76923#1946433 <https://reviews.llvm.org/D76923#1946433>, @nikic wrote:
>
> > I do wonder whether there's a middle ground here: Rather than adding a tag to `Use`, we could use a bit of subclass data on `CallInst` to indicate whether the call is droppable. That would reduce `User->isDroppable()` to a compare and mask check, and we could at least inline it.
>
>
> from profiling i saw that most of the cost of getSingleUndroppableUse comes from Use::getUser (+0.16%) and not from User::isDroppable (+0.05%). so i don't think this would make the difference we want.
>
> with this revision i moved the tag to the Prev pointer because it is accessed much less than Val and it already has a tag so i just added a bit to the tag.
>  maybe this revision has less overhead.


Indeed, I'm seeing a 0.1% improvement <http://llvm-compile-time-tracker.com/compare.php?from=17e4c38739aa78638c783dac6c149858d1c0a550&to=1d0368dd3677f5c824da1c7cd178495cd8f37b35&stat=instructions> with this version, which is about the size of the original regression.

It's not clear to me that this is actually safe though. On 32-bit platforms, wouldn't `Use` only be 4-aligned? Or does LLVM use a special allocator that provides stronger alignment guarantees?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76923





More information about the llvm-commits mailing list