[InstSimplify] fixed (?) to not mutate icmps
authorSanjay Patel <spatel@rotateright.com>
Tue, 6 Dec 2016 22:09:52 +0000 (22:09 +0000)
committerSanjay Patel <spatel@rotateright.com>
Tue, 6 Dec 2016 22:09:52 +0000 (22:09 +0000)
commit5369775a848db9840c52951dcc86ffe3a7db3616
tree93f2a397b4bd9f8499e64a847e1b5e8d75bb1d72
parent74cf034805de5239952ee8f33f47d624cb82cca0
[InstSimplify] fixed (?) to not mutate icmps

As Eli noted in the post-commit thread for r288833, the use of
swapOperands() may not be allowed in InstSimplify, so I'm
removing those calls here pending further review.

The swap mutates the icmp, and there doesn't appear to be precedent
for instruction mutation in InstSimplify.

I didn't actually have any tests for those cases, so I'm adding
a few here.

llvm-svn: 288855
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstSimplify/and-icmps-same-ops.ll
llvm/test/Transforms/InstSimplify/or-icmps-same-ops.ll