diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2016-12-06 22:09:52 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2016-12-06 22:09:52 +0000 |
| commit | 5369775a848db9840c52951dcc86ffe3a7db3616 (patch) | |
| tree | 93f2a397b4bd9f8499e64a847e1b5e8d75bb1d72 /llvm/test/Transforms/InstSimplify/and-icmps-same-ops.ll | |
| parent | 74cf034805de5239952ee8f33f47d624cb82cca0 (diff) | |
| download | bcm5719-llvm-5369775a848db9840c52951dcc86ffe3a7db3616.tar.gz bcm5719-llvm-5369775a848db9840c52951dcc86ffe3a7db3616.zip | |
[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
Diffstat (limited to 'llvm/test/Transforms/InstSimplify/and-icmps-same-ops.ll')
| -rw-r--r-- | llvm/test/Transforms/InstSimplify/and-icmps-same-ops.ll | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/and-icmps-same-ops.ll b/llvm/test/Transforms/InstSimplify/and-icmps-same-ops.ll index 8a665c33997..4da79388f72 100644 --- a/llvm/test/Transforms/InstSimplify/and-icmps-same-ops.ll +++ b/llvm/test/Transforms/InstSimplify/and-icmps-same-ops.ll @@ -1211,3 +1211,29 @@ define <2 x i1> @ult_ule_vec(<2 x i8> %a, <2 x i8> %b) { ret <2 x i1> %and } +define i1 @ult_uge_swap(i8 %a, i8 %b) { +; CHECK-LABEL: @ult_uge_swap( +; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i8 %a, %b +; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i8 %b, %a +; CHECK-NEXT: [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]] +; CHECK-NEXT: ret i1 [[AND]] +; + %cmp1 = icmp ult i8 %a, %b + %cmp2 = icmp uge i8 %b, %a + %and = and i1 %cmp1, %cmp2 + ret i1 %and +} + +define i1 @ult_ult_swap(i8 %a, i8 %b) { +; CHECK-LABEL: @ult_ult_swap( +; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i8 %a, %b +; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i8 %b, %a +; CHECK-NEXT: [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]] +; CHECK-NEXT: ret i1 [[AND]] +; + %cmp1 = icmp ult i8 %a, %b + %cmp2 = icmp ult i8 %b, %a + %and = and i1 %cmp1, %cmp2 + ret i1 %and +} + |

