)]}'
{
  "commit": "7ebe4eb29d8fc0167f98705b53b4fddb28f0cffb",
  "tree": "d21fa94c2c5935d52fdae3ccce32255c03b858b4",
  "parents": [
    "091a150a8a51bc953906d3da2a1a09d83fc36633"
  ],
  "author": {
    "name": "Kyrylo Tkachov",
    "email": "ktkachov@nvidia.com",
    "time": "Wed Jul 29 21:26:46 2026 +0200"
  },
  "committer": {
    "name": "Kyrylo Tkachov",
    "email": "ktkachov@nvidia.com",
    "time": "Thu Aug 06 11:21:08 2026 +0200"
  },
  "message": "match: fold a remainder compared with its dividend\n\nA remainder of non-negative operands equals its dividend exactly when the\ndividend is smaller than the divisor.  Comparing the two therefore does\nnot need the division at all.  This sits next to the (X / Y) \u003d\u003d 0 rule,\nwhich has the same shape and the same non-negativity requirement.\n\n  int f (unsigned x, unsigned y) { return x % y \u003d\u003d x; }\n\naarch64 -O2:\n\n  before                          after\n    udiv  w2, w0, w1                cmp   w0, w1\n    msub  w2, w2, w1, w0            cset  w0, cc\n    cmp   w2, w0\n    cset  w0, eq\n\nA zero divisor can raise a non-call exception.  Keep the division or\nremainder when the divisor might be zero and non-call exceptions are\nenabled.  Also keep an explicit zero divisor for diagnostics.\n\nBootstrapped and tested on aarch64-none-linux-gnu.\n\ngcc/ChangeLog:\n\n\t* match.pd ((X / Y) \u003d\u003d/!\u003d 0): Preserve a possible zero-divisor\n\texception.\n\t((X % Y) \u003d\u003d/!\u003d X): New simplification.  Preserve a possible\n\tzero-divisor exception.\n\ngcc/testsuite/ChangeLog:\n\n\t* gcc.dg/tree-ssa/modcmp-1.c: New test.\n\t* gcc.dg/tree-ssa/modcmp-noncall-1.c: Likewise.\n\nSigned-off-by: Kyrylo Tkachov \u003cktkachov@nvidia.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "e99a35046bc866fc21db6b8b8fe7bedcceee6fe3",
      "old_mode": 33188,
      "old_path": "gcc/match.pd",
      "new_id": "66cf628fc613c29a302ef492c88915e94320c215",
      "new_mode": 33188,
      "new_path": "gcc/match.pd"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "a59882e66a3a06dce60783089e4a025b22462f08",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.dg/tree-ssa/modcmp-1.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "aa5074b45173da96e4ac5dfcba6b1410d005afe7",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.dg/tree-ssa/modcmp-noncall-1.c"
    }
  ]
}
