This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner][X86][SystemZ][AArch64] Combine some cases of (bitcast (build_vector constants)) between legalize types and legalize dag.
ClosedPublic

Authored by craig.topper on Mar 3 2019, 12:25 AM.

Details

Summary

This patch enables combining integer bitcasts of integer build vectors when the new scalar type is legal. I've avoided floating point because the implementation bitcasts float to int along the way and we would need to check the intermediate types for legality.

Diff Detail

Event Timeline

craig.topper created this revision.Mar 3 2019, 12:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2019, 12:25 AM
spatel added inline comments.
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
10210–10211

Remove the 'Even if' line of the comment now? Add a TODO for FP?

test/CodeGen/SystemZ/vec-extract-01.ll
9

cc @uweigand @jonpa to confirm this diff is ok.

Modify comment and add a FIXME

uweigand added inline comments.Mar 4 2019, 6:08 AM
test/CodeGen/SystemZ/vec-extract-01.ll
9

The new code is certainly correct. Performance-wise it's probably a wash: we now need two instructions instead of one, but on the other hand we're avoiding a memory access ...

But that's a separate discussion to be had, since if we prefer the constant pool access we should also use it when loading an integer constant to begin with.

So this patch, which simply treats integer constant loads and vector constant loads the same here, should be OK in any case.

spatel accepted this revision.Mar 4 2019, 9:35 AM

LGTM

This revision is now accepted and ready to land.Mar 4 2019, 9:35 AM
This revision was automatically updated to reflect the committed changes.