This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Fix PR35618: Instcombine hangs on single minmax load bitcast.
ClosedPublic

Authored by ABataev on Dec 11 2017, 9:14 AM.

Details

Summary

If we have pattern `store (load(bitcast(select (cmp(V1, V2), &V1,
&V2)))), bitcast)`, but the load is used in other instructions, it leads
to looping in InstCombiner. Patch adds additional check that all users
of the load instructions are stores and then replaces all uses of load
instruction by the new one with new type.

Diff Detail

Repository
rL LLVM

Event Timeline

ABataev created this revision.Dec 11 2017, 9:14 AM
RKSimon edited edge metadata.Dec 11 2017, 9:28 AM

Isn't that PR35618? Typo in subject line.

test/Transforms/InstCombine/multiple-uses-load-bitcast-select.ll
6 ↗(On Diff #126384)

Do you need this test given that @spatel reduced it to the one below?

Isn't that PR35618? Typo in subject line.

Yep, missed the digit

test/Transforms/InstCombine/multiple-uses-load-bitcast-select.ll
6 ↗(On Diff #126384)

I can remove it, sure

ABataev updated this revision to Diff 126385.Dec 11 2017, 9:32 AM

Removed extra test

ABataev retitled this revision from [InstCombine] Fix PR5618: Instcombine hangs on single minmax load bitcast. to [InstCombine] Fix PR35618: Instcombine hangs on single minmax load bitcast..Dec 11 2017, 9:32 AM
spatel accepted this revision.Dec 11 2017, 10:31 AM

LGTM. Since the bitcast-creating canonicalization that we're trying to inhibit can affect multiple stores, we have to handle that case too.

This revision is now accepted and ready to land.Dec 11 2017, 10:31 AM
This revision was automatically updated to reflect the committed changes.