[PATCH] D22421: [InstCombine] reassociate logic ops with constants separated by a zext

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 15 12:29:33 PDT 2016


spatel created this revision.
spatel added reviewers: majnemer, eli.friedman, sanjoy.
spatel added a subscriber: llvm-commits.
Herald added a subscriber: mcrosier.

This is a partial implementation of a general fold for associative+commutative operators:
(op (cast (op X, C2)), C1) --> (cast (op X, op (C1, C2)))
(op (cast (op X, C2)), C1) --> (op (cast X), op (C1, C2))

There are 7 associative operators and 13 cast types, so this could potentially go a lot further. But I'd like to make sure this much is implemented properly before extending.

Also, the zext + logic case should be enough to allow D22271 to proceed.

https://reviews.llvm.org/D22421

Files:
  lib/Transforms/InstCombine/InstructionCombining.cpp
  test/Transforms/InstCombine/assoc-cast-assoc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22421.64180.patch
Type: text/x-patch
Size: 5062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160715/912c8110/attachment.bin>


More information about the llvm-commits mailing list