[PATCH] [InstCombine] Attempt to eliminate redundant loads whose addresses are dependent on the result of a select instruction.

Tilmann Scheller t.scheller at samsung.com
Wed Sep 3 13:24:24 PDT 2014


Hi,

attached is the following patch:

[PATCH] [InstCombine] Attempt to eliminate redundant loads whose addresses are dependent on the result of a select instruction.

If both values have already been loaded into registers the load becomes redundant and can be replaced with a select on the two values instead, e.g. we can do the following transformation:

a = (load (gep idx_a))
b = (load (gep idx_b))
c = (load (gep (select (cond, idx_a, idx_b))))
  -->
a = (load (gep idx_a))
b = (load (gep idx_b))
c = (select (cond, a, b))



This particular pattern occurs in the hottest loop of 175.vpr from SPEC CPU2000. Haven't done any measurements yet but I would assume it improves performance (GCC is doing the above optimization and is ~10% faster on ARM)

This is my first patch for InstCombine, feedback welcome :)

Regards,

Tilmann
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-InstCombine-Attempt-to-eliminate-redundant-loads-who.patch
Type: application/octet-stream
Size: 6440 bytes
Desc: 0001-InstCombine-Attempt-to-eliminate-redundant-loads-who.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140903/146f10bd/attachment.obj>


More information about the llvm-commits mailing list