This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] scalarizePHI should not assume the code it sees has been CSE'd
ClosedPublic

Authored by mkuper on Jun 3 2016, 12:55 PM.

Details

Summary

scalarizePHI only looks for phis that have exactly two users - the "latch" use, and an extract. Unfortunately, we can not assume such extracts have been CSEd, since InstCombine itself may create an extract which is a duplicate of an existing one. This extends it to handle several extracts from the same index.

This hopefully fixes the performance regression in PR27988.

Diff Detail

Repository
rL LLVM

Event Timeline

mkuper updated this revision to Diff 59602.Jun 3 2016, 12:55 PM
mkuper retitled this revision from to [InstCombine] scalarizePHI should not assume the code it sees has been CSE'd.
mkuper updated this object.
mkuper added reviewers: majnemer, spatel.
mkuper added a subscriber: llvm-commits.
majnemer added inline comments.Jun 3 2016, 1:09 PM
lib/Transforms/InstCombine/InstCombineVectorOps.cpp
69 ↗(On Diff #59602)

Please clang-format this.

test/Transforms/InstCombine/vec_phi_extract.ll
30–32 ↗(On Diff #59602)

Please give these instructions some operands.

mkuper added a comment.Jun 3 2016, 2:02 PM

Thanks, David!

lib/Transforms/InstCombine/InstCombineVectorOps.cpp
69 ↗(On Diff #59602)

Argh, I was sure I did!

test/Transforms/InstCombine/vec_phi_extract.ll
30–32 ↗(On Diff #59602)

Yeah, should probably fix the rest of the test while I'm at it.

mkuper updated this revision to Diff 59622.Jun 3 2016, 2:12 PM

Updated per David's comments.

majnemer accepted this revision.Jun 6 2016, 3:38 PM
majnemer edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jun 6 2016, 3:38 PM
This revision was automatically updated to reflect the committed changes.