This is an archive of the discontinued LLVM Phabricator instance.

[LSR] adjust isHighCostExpansion function for Mul case
AbandonedPublic

Authored by danilaml on Mar 3 2021, 8:21 AM.

Details

Reviewers
atrick
lebedev.ri

Diff Detail

Event Timeline

danilaml created this revision.Mar 3 2021, 8:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2021, 8:21 AM
danilaml requested review of this revision.Mar 3 2021, 8:21 AM

This is mostly to get the comments on the original function and it's intent. Before this change the test would bail out on a first Instruction::Mul user which doesn't make much sense from the context. I.e. if there were two Mul users, one satisfying the SE.getSCEV(UI) == Mul condition, then whether the increment would be considered high cost would depend on the order of the Users in the users() list.
Also, it would return true (meaning high cost) if the existing instruction already computes given SCEV, which seems to be the opposite of the stated intent unless I'm misunderstanding something.

Another approach that was suggested is to replace this function with the SCEVExpander::isHighCostExpansion, however it doesn't seem to be trivial because 1) this is called at earlier stage when the IV chains are collected so I don't think there is any info like the insertion point and the like and creating the SCEVExpander instance solely to call the isHighCostExpansion feels weird 2) Those functions have different defaults (LSR one is high-cost-by-default) and different checks (i.e. this does some Phi checks).

lebedev.ri resigned from this revision.Jan 12 2023, 5:20 PM

This review seems to be stuck/dead, consider abandoning if no longer relevant.

Herald added a project: Restricted Project. · View Herald TranscriptJan 12 2023, 5:20 PM
Herald added a subscriber: StephenFan. · View Herald Transcript
danilaml abandoned this revision.Jan 13 2023, 5:25 AM