[PATCH] D62257: [DAGCombiner][X86][AArch64] (x - C) + y -> (x + y) - C fold

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 04:01:10 PDT 2019


lebedev.ri added a comment.

Hmm yeah, i should have seen it coming.
These patches will expose a lot of missing constant folds.
And by expose i mean it will stumble into cases like

  ; ((%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.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62257





More information about the llvm-commits mailing list