https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118945

--- Comment #1 from Vineet Gupta <vineetg at gcc dot gnu.org> ---
Looking at the VSETVL dumps:

Splitting with gen_split_2313 (vector.md:1777)
scanning new insn with uid = 70.                 # New VSETVL for vector load
deleting insn with uid = 16.                     # orig VSETVL for vector load
deleted
...
Entering Lazy VSETVL PASS

scanning new insn with uid = 71.
...

Phase 1: Fuse local vsetvl infos.


  Try fuse basic block 4
    Ignore curr info since prev info available with it:
      prev_info: VALID (insn 70, bb 4)
        Demand fields: demand_ratio_only demand_avl
        SEW=8, VLMUL=mf2, RATIO=16, MAX_SEW=64
        TAIL_POLICY=agnostic, MASK_POLICY=agnostic
        AVL=(reg:DI 11 a1 [orig:138 ivtmp_27 ] [138])
        VL=(reg:DI 15 a5 [orig:139 _29 ] [139])
        use_by_non_rvv_insn=true
      curr_info: VALID (insn 17, bb 4)
        Demand fields: demand_ratio_only demand_avl
        SEW=32, VLMUL=m2, RATIO=16, MAX_SEW=64
        TAIL_POLICY=agnostic, MASK_POLICY=agnostic
        AVL=(reg:DI 15 a5 [orig:139 _29 ] [139])
        VL=(nil)

    Fuse curr info since prev info compatible with it:
      prev_info: VALID (insn 70, bb 4)
        Demand fields: demand_ratio_only demand_avl
        SEW=8, VLMUL=mf2, RATIO=16, MAX_SEW=64
        TAIL_POLICY=agnostic, MASK_POLICY=agnostic
        AVL=(reg:DI 11 a1 [orig:138 ivtmp_27 ] [138])
        VL=(reg:DI 15 a5 [orig:139 _29 ] [139])
        use_by_non_rvv_insn=true

      curr_info: VALID (insn 18, bb 4)
        Demand fields: demand_sew_lmul demand_tail_policy_only demand_avl
        SEW=32, VLMUL=m2, RATIO=16, MAX_SEW=64
        TAIL_POLICY=undisturbed, MASK_POLICY=agnostic
        AVL=(reg:DI 15 a5 [orig:139 _29 ] [139])
        VL=(nil)

      prev_info after fused: VALID (insn 70, bb 4)
        Demand fields: demand_sew_lmul demand_tail_policy_only demand_avl
        SEW=32, VLMUL=m2, RATIO=16, MAX_SEW=64
        TAIL_POLICY=undisturbed, MASK_POLICY=agnostic
        AVL=(reg:DI 11 a1 [orig:138 ivtmp_27 ] [138])
        VL=(reg:DI 15 a5 [orig:139 _29

insn 70 and insn 18 are what we need to prevent from fusing/merging.
They do have different m_ta={true, false}.

However compatible_p() returns true because of demand tail policy being
different:

insn 70

  m_ta = true,
  m_ma = true,
  m_sew_lmul_demand = sew_lmul_demand_type::ratio_only,
  m_policy_demand = policy_demand_type::ignore_policy,
                             ^^^^^^^^^^^^^^^^^^
insn 18

  m_ta = false,
  m_ma = true,
  m_sew_lmul_demand = sew_lmul_demand_type::sew_lmul,
  m_policy_demand = policy_demand_type::tail_policy_only
                             ^^^^^^^^^^^^^^^^^^

insn 70 is the new VSETVL which is generated off the no side effect splitter ad
policy demand is just initialized to 0 (ignore_policy)

Reply via email to