This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner][x86] scalarize inserted vector FP ops
ClosedPublic

Authored by spatel on Apr 10 2019, 8:12 AM.

Details

Summary
// bo (build_vec ...undef, x, undef...), (build_vec ...undef, y, undef...) -->
// build_vec ...undef, (bo x, y), undef...

The lifetime of the nodes in these examples is different for variables versus constants, but they are all build vectors briefly, so I'm proposing to catch them in this form to handle all of the leading examples in the motivating test file.

Before we have build vectors, we might have insert_vector_element. After that, we might have scalar_to_vector and constant pool loads.

It's going to take more work to ensure that FP vector operands are getting simplified with undef elements, so this transform can apply more widely. In a non-loose FP environment, we are likely simplifying FP elements to NaN values rather than undefs.

We also need to allow more opcodes down this path. Eg, we don't handle FP min/max flavors yet.

Diff Detail

Repository
rL LLVM

Event Timeline

spatel created this revision.Apr 10 2019, 8:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 10 2019, 8:12 AM
RKSimon accepted this revision.Apr 11 2019, 3:08 AM

LGTM with a few minors

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
18711 ↗(On Diff #194518)

This might be too harsh as the BV ops might be available as cheap scalars already - add a TODO for now?

18717 ↗(On Diff #194518)

Do this check earlier?

18722 ↗(On Diff #194518)

Check legality of scalar binop?

This revision is now accepted and ready to land.Apr 11 2019, 3:08 AM
spatel marked 3 inline comments as done.Apr 11 2019, 7:18 AM
This revision was automatically updated to reflect the committed changes.