This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Don't transform (select c, ext(TI), ext(FI)) if ext is free
AbandonedPublic

Authored by Carrot on Jan 15 2021, 6:04 PM.

Details

Reviewers
lebedev.ri
Summary

Function InstCombinerImpl::foldSelectOpOp can do following transformation

(select c, ext(TI), ext(FI))  ==> (ext(select c, TI, FI))

If TI and FI are load, then ext is free on x86, in this situation we should not move ext out of select.

Diff Detail

Event Timeline

Carrot created this revision.Jan 15 2021, 6:04 PM
Carrot requested review of this revision.Jan 15 2021, 6:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 15 2021, 6:04 PM
lebedev.ri requested changes to this revision.Jan 16 2021, 1:58 AM
lebedev.ri added a subscriber: lebedev.ri.

InstCombine is a canonicalization pass, and by design it must not make use of TTI.
This should be fixed by a reverse transformation in backend.

This revision now requires changes to proceed.Jan 16 2021, 1:58 AM

Thanks for the info.

I will discard this patch and reverse the pattern at function CodeGenPrepare::optimizeExt.

Carrot abandoned this revision.Jan 19 2021, 1:04 PM

Thanks for the info.

I will discard this patch and reverse the pattern at function CodeGenPrepare::optimizeExt.

Not really sure why that would go into CodeGenPrepare, which is a temporary hack,
DAGCombine is the usual counterpart.

Thanks for the info.

I will discard this patch and reverse the pattern at function CodeGenPrepare::optimizeExt.

Not really sure why that would go into CodeGenPrepare, which is a temporary hack,
DAGCombine is the usual counterpart.

Because I found CodeGenPrepare::optimizeExt does some ext(load( )) optimization.
Will look into DAGCombine.
Thanks.