[PATCH] D87408: [NFC] EliminateDuplicatePHINodes(): drop DenseMap-driven CSE in favor of quadratic algorithmn

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 12:11:54 PDT 2020


lebedev.ri created this revision.
lebedev.ri added reviewers: fhahn, nikic, spatel, efriedma, reames.
lebedev.ri added a project: LLVM.
Herald added subscribers: dexonsmith, hiraditya.
lebedev.ri requested review of this revision.

This is functionally equivalent to the old implementation.

As per https://llvm-compile-time-tracker.com/compare.php?from=25f3cc0ced1759af1911c2446ac40fab4f5e5571&to=b61307f6f13cb1020d0940c2d3103a0a2493b2ce&stat=instructions
this is a geomean compile-time regression-free win of `-0.08%` for `-O3`, `-0.09%` for `-O3 -flto=thin`;
but it's more controversial than that for `-O3 -flto`, where while it's still a geomean win (`-0.01%`), there are regressions.

However compile-time isn't the main motivation here.
I can name at least 3 limitations of this CSE:

1. Assumes that all PHI nodes have incoming basic blocks in the same order (can be fixed while keeping the DenseMap)
2. Does not special-handle `undef` incoming values (maybe can be fixed by hashing backedge as some magical value)
3. Does not special-handle backedge incoming values (i don't see how we can do this with hashing)

Thoughts?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87408

Files:
  llvm/lib/IR/Instruction.cpp
  llvm/lib/Transforms/Utils/Local.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87408.290789.patch
Type: text/x-patch
Size: 4490 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200909/f422860c/attachment.bin>


More information about the llvm-commits mailing list