[DAGCombiner] use narrow load to avoid vector extract
authorSanjay Patel <spatel@rotateright.com>
Sat, 27 May 2017 14:07:03 +0000 (14:07 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sat, 27 May 2017 14:07:03 +0000 (14:07 +0000)
commit33f4a9728741b1305496ec89f5b472a57e21a32b
tree647340b9f5eb29c43204f874206ff6a7cae58647
parent7aa22859b66223c59a5dacc45e8bd7535659057b
[DAGCombiner] use narrow load to avoid vector extract

If we have (extract_subvector(load wide vector)) with no other users,
that can just be (load narrow vector). This is intentionally conservative.
Follow-ups may loosen the one-use constraint to account for the extract cost
or just remove the one-use check.

The memop chain updating is based on code that already exists multiple times
in x86 lowering, so that should be pulled into a helper function as a follow-up.

Background: this is a potential improvement noticed via regressions caused by
making x86's peekThroughBitcasts() not loop on consecutive bitcasts (see
comments in D33137).

Differential Revision: https://reviews.llvm.org/D33578

llvm-svn: 304072
13 files changed:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/arm64-vabs.ll
llvm/test/CodeGen/AArch64/arm64-vadd.ll
llvm/test/CodeGen/AArch64/arm64-vmul.ll
llvm/test/CodeGen/AArch64/arm64-vshift.ll
llvm/test/CodeGen/AArch64/arm64-vsub.ll
llvm/test/CodeGen/ARM/vcombine.ll
llvm/test/CodeGen/ARM/vext.ll
llvm/test/CodeGen/X86/avx512bw-intrinsics.ll
llvm/test/CodeGen/X86/vector-shuffle-512-v16.ll
llvm/test/CodeGen/X86/vector-shuffle-avx512.ll
llvm/test/CodeGen/X86/widened-broadcast.ll
llvm/test/CodeGen/X86/x86-interleaved-access.ll