Only vector tests are being affected here,
since subtraction by scalar constant is rewritten
as addition by negated constant.
No surprising test changes.
Paths
| Differential D62257
[DAGCombiner][X86][AArch64] (x - C) + y -> (x + y) - C fold ClosedPublic Authored by lebedev.ri on May 22 2019, 8:10 AM.
Details
Summary Only vector tests are being affected here, No surprising test changes.
Diff Detail
Event TimelineComment Actions Its rather annoying that the DAGCombiner::visitSUB limits the (sub x, c) -> (add x, -c) fold to non-vectors Comment Actions
I suppose i could take a look at that, but i'd like to cram out the remaining patches for sink-addsub-of-const.ll. Comment Actions LGTM with one minor
This revision is now accepted and ready to land.May 26 2019, 6:16 AM Closed by commit rL361854: [DAGCombiner][X86][AArch64] (x - C) + y -> (x + y) - C fold (authored by lebedevri). · Explain WhyMay 28 2019, 10:51 AM This revision was automatically updated to reflect the committed changes. This revision is now accepted and ready to land.May 28 2019, 12:04 PM Comment Actions
And reduced test-suite/MultiSource/Benchmarks/TSVC/ControlFlow-dbl/tsc.c to ; ModuleID = 'bugpoint-reduced-simplified.bc' source_filename = "input.c" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define dso_local <4 x i32> @b(<4 x i64> %arg) local_unnamed_addr #0 { %t0 = add <4 x i64> %arg, <i64 8, i64 8, i64 8, i64 8> %t1 = trunc <4 x i64> %t0 to <4 x i32> %t2 = add <4 x i32> %t1, <i32 1, i32 1, i32 1, i32 1> %t3 = and <4 x i32> %t2, <i32 3, i32 3, i32 3, i32 3> ret <4 x i32> %t3 } attributes #0 = { "use-soft-float"="false" } !llvm.ident = !{!0} !0 = !{!"clang version 9.0.0 (trunk 362014) (llvm/trunk 362022)"} Comment Actions Hmm yeah, i should have seen it coming. ; ((%arg0 + 8) - (-1)) %t0 = add %arg0, 8 ; 8 is constant, so hoist binop %t1 = sub %t0, -1 and will change that to ; ((%arg0 - (-1)) + 8) %t0 = sub %arg0, -1 ; -1 is constant, so hoist binop %t1 = add %t0, 8 and then the complementary fold will undo that, if we fail to constant-fold inbetween. lebedev.ri removed a parent revision: D62664: [DAGCombine] (A+C1)-C2 -> A+(C1-C2) constant-fold.May 30 2019, 9:36 AM lebedev.ri removed a child revision: D62263: [DAGCombine][X86][AArch64][AMDGPU] (x - y) + -1 -> add (xor y, -1), x fold.May 30 2019, 1:21 PM lebedev.ri removed a parent revision: D62252: [DAGCombiner][X86][AArch64][SPARC][SystemZ] y - (x + C) -> (y - x) - C fold. lebedev.ri added a child revision: D62266: [DAGCombine][X86][AArch64][ARM] (C - x) + y -> (y - x) + C fold.May 30 2019, 1:24 PM Closed by commit rL362146: [DAGCombiner][X86][AArch64] (x - C) + y -> (x + y) - C fold. Try 2 (authored by lebedevri). · Explain WhyMay 30 2019, 1:36 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 202290 llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/trunk/test/CodeGen/AArch64/sink-addsub-of-const.ll
llvm/trunk/test/CodeGen/X86/sink-addsub-of-const.ll
llvm/trunk/test/CodeGen/X86/vector-idiv-sdiv-128.ll
llvm/trunk/test/CodeGen/X86/vector-idiv-sdiv-256.ll
llvm/trunk/test/CodeGen/X86/vector-idiv-sdiv-512.ll
|