)]}'
{
  "commit": "bb1344be44e364da8377603697933a668b651c4e",
  "tree": "2d145173fd25e7e0861f850f0c12bdb882793457",
  "parents": [
    "b01cd452a6c7ba2a2f95a77f62f0727cbbe9d6a5"
  ],
  "author": {
    "name": "Richard Biener",
    "email": "rguenther@suse.de",
    "time": "Wed Aug 19 14:50:09 2026 +0200"
  },
  "committer": {
    "name": "Richard Biener",
    "email": "rguenther@suse.de",
    "time": "Fri Aug 21 11:26:05 2026 +0200"
  },
  "message": "choose VF independent of externs/constants\n\nThe following decides on the VF based on assigned SLP_TREE_VECTYPE\nrather than on the tracked max_nunits in the SLP graph which also\nfactors in external and constant nodes.  Those get their vector\ntype assigned in vectorizable_* via vect_maybe_update_slp_op_vectype\nand there\u0027s freedom to vectorizable_* to pick a suitable one.\n\nSpecifically conversions of externs/constants can cause a higher\nthan necessary VF which would be a missed optimization.\n\nChanging the VF as outlined will run into both vect_prologue_cost_for_slp\nand vect_create_constant_vectors ICEing when computing\nvect_get_num_copies since that asserts it can exact_div the\nnumber of lanes as in the unrolled loop by the number of lanes in the\n(out of loop) vector type.  But vectorizable_* can opt to just\nuse the lowpart of such vectors but require it in full due to target\nconstraints.  So this RFC patch introduces vect_get_num_copies_for_invariant\nwhich performs a ceil_div instead (I think we can maybe change the global\ncopy to do that).  I added verification to vect_slp_analyze_node_operations\nwhich should make the vect_maybe_update_slp_op_vectype change in\nthe predicated tails series unneeded.\n\nThis shifts the ICE to vectorizable_conversion which is mightly confused\nby invariant vectors with too many lanes (in O3-vect-pr32243.c it is\nunswitching that exposes a loop invariant conversion in the loop).\nI have installed a narrow fix that is likely incomplete and I expect\nsimilar issues to appear in multi-operand widening/narrowing operations.\n\nThe fundamental issue is that we expose constant/externals to\nvectorizable_* that might have an excess number of lanes, and some\nvectorizable_* might not be prepared (and most should be unaffected).\nAs vectorizable_* control the vector types themselves the fix lies\nwithin them.  Once fuzzers increase coverage.\n\n\t* tree-vect-slp.cc (vect_update_slp_vf_for_node): Compute\n\tVF based on SLP_TREE_VECTYPE only.\n\t(vect_get_num_copies_for_invariant): New.\n\t(vect_prologue_cost_for_slp): Take nvectors as argument.\n\t(vect_slp_analyze_node_operations): Verify that we can\n\tdiv_away_from_zero for vect_prologue_cost_for_slp.\n\t(vect_create_constant_vectors): Use vect_get_num_copies_for_invariant.\n\t* tree-vect-stmts.cc (vect_create_vectorized_promotion_stmts):\n\tSupport creating half of the promoted results.\n\t(vectorizable_conversion): When we have excess input elements\n\trequest half of the promoted results.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "9dce9208626e467e84b19e519a9c6ba33431126e",
      "old_mode": 33188,
      "old_path": "gcc/tree-vect-slp.cc",
      "new_id": "a2b679df9700a2e9dcee331fd1868eda8025c655",
      "new_mode": 33188,
      "new_path": "gcc/tree-vect-slp.cc"
    },
    {
      "type": "modify",
      "old_id": "38a17e29a84ca87df469881cfef02823ea60ae09",
      "old_mode": 33188,
      "old_path": "gcc/tree-vect-stmts.cc",
      "new_id": "a8a2ec62920d343a1603c96cb73f7978497d3f28",
      "new_mode": 33188,
      "new_path": "gcc/tree-vect-stmts.cc"
    }
  ]
}
