diff options
Diffstat (limited to 'llvm/test/Transforms/InstCombine/max-of-nots.ll')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/max-of-nots.ll | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/test/Transforms/InstCombine/max-of-nots.ll b/llvm/test/Transforms/InstCombine/max-of-nots.ll index ca9520a7f51..96fac522897 100644 --- a/llvm/test/Transforms/InstCombine/max-of-nots.ll +++ b/llvm/test/Transforms/InstCombine/max-of-nots.ll @@ -34,13 +34,15 @@ define i32 @compute_min_3(i32 %x, i32 %y, i32 %z) { ret i32 %min } +; Don't increase the critical path by moving the 'not' op after the 'select'. + define i32 @compute_min_arithmetic(i32 %x, i32 %y) { ; CHECK-LABEL: @compute_min_arithmetic( -; CHECK-NEXT: [[TMP1:%.*]] = add i32 %x, -4 -; CHECK-NEXT: [[TMP2:%.*]] = icmp slt i32 [[TMP1]], %y -; CHECK-NEXT: [[TMP3:%.*]] = select i1 [[TMP2]], i32 [[TMP1]], i32 %y -; CHECK-NEXT: [[TMP4:%.*]] = xor i32 [[TMP3]], -1 -; CHECK-NEXT: ret i32 [[TMP4]] +; CHECK-NEXT: [[NOT_VALUE:%.*]] = sub i32 3, %x +; CHECK-NEXT: [[NOT_Y:%.*]] = xor i32 %y, -1 +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[NOT_VALUE]], [[NOT_Y]] +; CHECK-NEXT: [[NOT_MIN:%.*]] = select i1 [[CMP]], i32 [[NOT_VALUE]], i32 [[NOT_Y]] +; CHECK-NEXT: ret i32 [[NOT_MIN]] ; %not_value = sub i32 3, %x %not_y = sub i32 -1, %y |

