[InstCombine] refactor visitOr() to use foldCastedBitwiseLogic()
authorSanjay Patel <spatel@rotateright.com>
Tue, 23 Feb 2016 23:56:23 +0000 (23:56 +0000)
committerSanjay Patel <spatel@rotateright.com>
Tue, 23 Feb 2016 23:56:23 +0000 (23:56 +0000)
commit75b4ae25cb3ba24ddbbec9780dcdd15df022b6cc
tree139b856c167084156e8bb8c1b58769b0a475841b
parentbec78181d3b25d9d76c21a599162d2746122d541
[InstCombine] refactor visitOr() to use foldCastedBitwiseLogic()

Note: The 'and' case in foldCastedBitwiseLogic() is inheriting one extra
check from the nearly identical 'or' case:
  if ((!isa<ICmpInst>(Cast0Src) || !isa<ICmpInst>(Cast1Src))

But I'm not sure how to expose that difference in a regression test.
Without that check, the 'or' path will infinite loop on:
test/Transforms/InstCombine/zext-or-icmp.ll
because the zext-or-icmp fold is attempting a reverse transform.

The refactoring should extend to the 'xor' case next to solve part of
PR26702.

llvm-svn: 261707
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp