[PATCH] Extend EarlyCSE to handle basic cases from JumpThreading and CVP
Daniel Berlin
dberlin at dberlin.org
Wed May 13 17:14:10 PDT 2015
This is a good question.
I looked through, and i see that it is a common idiom, but often there
is a small amount of other code people are doing in the middle or as
part of replacement. For example,
Transforms/ObjCARC/ObjCARCContract.cpp:552
If it's not too much to ask, i actually think the best option may be
something like "a dominated use iterator".
IE
Instead of replaceAllDominatedUses(From, To, DomRoot)
for (auto &Use : dominated_edge_uses(From, DomRoot))
{
// Do whatever extra stuff they they want
Use.set(To);
}
and
instead of
replaceAllDominatedUses(From, To, From->getParent())
for (auto &Use: dominated_uses(From))
Use.set(To);
If that's too much, let's just put replaceAllDominatedUses in local.* for now.
On Wed, May 13, 2015 at 4:13 PM, Philip Reames
<listmail at philipreames.com> wrote:
> ================
> Comment at: lib/Transforms/Scalar/EarlyCSE.cpp:490
> @@ +489,3 @@
> + ToUpdate.push_back(IU);
> + for (Instruction *UserI : ToUpdate) {
> + DEBUG(dbgs() << "EarlyCSE CVP: Replace dominated use of '"
> ----------------
> dberlin wrote:
>> Can you common this part with GVN's replaceAllDominatedUsesWith?
>>
>> (IE just move that function somewhere common and use it?)
> Absolutely. Didn't know that existed. Would it make sense to put that directly on Value? Or would you rather see it as a helper function in Local.h or someplace similar?
>
> http://reviews.llvm.org/D9763
>
> EMAIL PREFERENCES
> http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
More information about the llvm-commits
mailing list