[PATCH] D27861: [DAGCombiner] Match load by bytes idiom and fold it into a single load. Attempt #2.
Artur Pilipenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 16 13:48:51 PST 2016
apilipenko created this revision.
apilipenko added reviewers: hfinkel, RKSimon, filcab, chandlerc.
apilipenko added a subscriber: llvm-commits.
The previous patch (https://reviews.llvm.org/rL289538) got reverted because of a bug. Chandler also requested some changes to the algorithm.
This is an updated patch. The key difference is that collectBitProviders now collects the origin of one byte, not the whole value. It simplifies the implementation and allows to stop the traversal earlier if we know that the result won't be used.
From the original review:
Match a pattern where a wide type scalar value is loaded by several narrow loads and combined by shifts and ors. Fold it into a single load or a load and a bswap if the targets supports it.
Assuming little endian target:
i8 *a = ...
i32 val = a | (a << 8) | (a << 16) | (a << 24)
i32 val = *((i32)a)
i8 *a = ...
i32 val = (a << 24) | (a << 16) | (a << 8) | a
i32 val = BSWAP(*((i32)a))
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 64931 bytes
Desc: not available
More information about the llvm-commits