Baseline tests for D59471 (InstCombine of add nuw and uaddo with
constants).
Details
Diff Detail
Event Timeline
llvm/test/Transforms/InstCombine/uadd-with-overflow.ll | ||
---|---|---|
3 | Please run this test input through -instnamer first, and then strreplace tmp with t. |
llvm/test/Transforms/InstCombine/uadd-with-overflow.ll | ||
---|---|---|
87–96 | Also add test with plain add. |
@lebedev.ri Both of your comments would also be valid for the tests for D58881. Should I update the tests there too?
llvm/test/Transforms/InstCombine/uadd-with-overflow.ll | ||
---|---|---|
3 | Thanks! Good to know | |
87–96 | Will do. |
LG
llvm/test/Transforms/InstCombine/uadd-with-overflow.ll | ||
---|---|---|
55 | You could also add variations with non-splat non-undef constants |
llvm/test/Transforms/InstCombine/uadd-with-overflow.ll | ||
---|---|---|
55 | I'm not sure I follow. Wouldn't a non-splat non-undef variation of this test be something like simple_fold on line 10? |
llvm/test/Transforms/InstCombine/uadd-with-overflow.ll | ||
---|---|---|
55 | I meant something like %a = add nuw <2 x i32> %x, <i32 12, i32 13> ; not splat, but still no overflow, but won't get folded %b = tail call { <2 x i32>, <2 x i1> } @llvm.uadd.with.overflow.v2i32(<2 x i32> %a, <2 x i32> <i32 30, i32 30>) %a = add nuw <2 x i32> %x, <i32 12, i32 4294967280> ; not splat, overflow %b = tail call { <2 x i32>, <2 x i1> } @llvm.uadd.with.overflow.v2i32(<2 x i32> %a, <2 x i32> <i32 30, i32 255>) |
llvm/test/Transforms/InstCombine/uadd-with-overflow.ll | ||
---|---|---|
55 | To clarify terminology: "Splat" here means that all elements of a vector constant are the same (or undef, in which case we may assume them to be the same). Non-splat is if the elements differ. For many optimizations only the splat case is supported, because it is handled by matchers like m_APInt(). Handling non-splat cases typically requires using ConstantExpr based operations (instead of much more convenient APInt ones), so mostly nobody bothers... |
llvm/test/Transforms/InstCombine/uadd-with-overflow.ll | ||
---|---|---|
55 | Right, i should have explained that. I didn't get that at first too. |
llvm/test/Transforms/InstCombine/uadd-with-overflow.ll | ||
---|---|---|
55 | Ah yeah I was confusing vector and splat. Thanks updated the patch. |
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