[PATCH] D52439: [InstCombine] try to convert vector insert+extract to trunc

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 24 14:55:22 PDT 2018


spatel created this revision.
spatel added reviewers: efriedma, RKSimon, lebedev.ri, craig.topper.
Herald added a subscriber: mcrosier.

This transform is requested for the backend in:
https://bugs.llvm.org/show_bug.cgi?id=39016
...but I figured it was worth doing in IR too, and it's probably easier to implement here, so that's this patch.

In the simplest case, we are just truncating a scalar value. If the extract index doesn't correspond to the LSBs of the scalar, then we have to shift-right before the truncate. Endian-ness makes this tricky, but hopefully the ASCII-art helps visualize the transform.


https://reviews.llvm.org/D52439

Files:
  lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  test/Transforms/InstCombine/extractelement.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52439.166761.patch
Type: text/x-patch
Size: 8340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180924/99021608/attachment.bin>


More information about the llvm-commits mailing list