Baseline tests for D59471 (InstCombine of add nuw and uaddo with
constants).
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
llvm/test/Transforms/InstCombine/uadd-with-overflow.ll | ||
---|---|---|
3 ↗ | (On Diff #191023) | Please run this test input through -instnamer first, and then strreplace tmp with t. |
llvm/test/Transforms/InstCombine/uadd-with-overflow.ll | ||
---|---|---|
87–96 ↗ | (On Diff #191023) | 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 ↗ | (On Diff #191023) | Thanks! Good to know |
87–96 ↗ | (On Diff #191023) | Will do. |
LG
llvm/test/Transforms/InstCombine/uadd-with-overflow.ll | ||
---|---|---|
54 ↗ | (On Diff #191027) | You could also add variations with non-splat non-undef constants |
llvm/test/Transforms/InstCombine/uadd-with-overflow.ll | ||
---|---|---|
54 ↗ | (On Diff #191027) | 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 | ||
---|---|---|
54 ↗ | (On Diff #191027) | 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 | ||
---|---|---|
54 ↗ | (On Diff #191027) | 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 | ||
---|---|---|
54 ↗ | (On Diff #191027) | Right, i should have explained that. I didn't get that at first too. |
llvm/test/Transforms/InstCombine/uadd-with-overflow.ll | ||
---|---|---|
54 ↗ | (On Diff #191027) | Ah yeah I was confusing vector and splat. Thanks updated the patch. |