GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
middle-end

Use correct mode for masked cbranch operand

Fixes an assertion failure related to vector boolean constants in masked operations.

This change corrects how the mode for masked cbranch operands is determined. Previously, it used GET_MODE on an expanded masked operation, which could incorrectly result in VOIDmode for vector boolean constants. The fix adjusts this to use TYPE_MODE of the operand, ensuring constants are materialized in the correct mask mode and preventing an assertion failure.

In Details

The function emit_cmp_and_jump_insns in optabs.cc previously used GET_MODE(expand_normal(masked_op)) to determine the mode for masked operations. When masked_op expanded to a CONST_INT representing a vector boolean constant, this could lead to VOIDmode. The fix changes this to TYPE_MODE(TREE_TYPE(masked_op)), correctly using the mode of the operand's type, which resolves the assertion mode != VOID_mode in maybe_legitimize_operand.

Filed Under: vectorizationoptimization