[PATCH] D59472: [InstCombine] Add tests for add nuw + uaddo

Dan Robertson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 17 09:35:40 PDT 2019


dlrobertson marked 2 inline comments as done.
dlrobertson added a comment.

@lebedev.ri Both of your comments would also be valid for the tests for D58881 <https://reviews.llvm.org/D58881>. Should I update the tests there too?



================
Comment at: llvm/test/Transforms/InstCombine/uadd-with-overflow.ll:3
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+declare { <2 x i32>, <2 x i1> } @llvm.uadd.with.overflow.v2i32(<2 x i32>, <2 x i32>)
----------------
lebedev.ri wrote:
> Please run this test input through `-instnamer` first, and then strreplace `tmp` with `t`.
> Else update script may get confused, or the output will be confusing to read.
> 
> https://godbolt.org/z/bX1_Os
Thanks! Good to know


================
Comment at: llvm/test/Transforms/InstCombine/uadd-with-overflow.ll:87-96
+define { i32, i1 } @no_fold_nsw(i32) {
+; CHECK-LABEL: @no_fold_nsw(
+; CHECK-NEXT:    [[TMP2:%.*]] = add nsw i32 [[TMP0:%.*]], 12
+; CHECK-NEXT:    [[TMP3:%.*]] = tail call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 [[TMP2]], i32 30)
+; CHECK-NEXT:    ret { i32, i1 } [[TMP3]]
+;
+  %2 = add nsw i32 %0, 12
----------------
lebedev.ri wrote:
> Also add test with plain `add`.
Will do.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59472/new/

https://reviews.llvm.org/D59472





More information about the llvm-commits mailing list