GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gimple-fold

GIMPLE-fold: Fix vector length/store folding with bias.

Corrects folding of vector length load/store operations that use a target-specific bias.

This commit corrects the GIMPLE optimization pass for folding vector length load and store operations when a target-specific bias is involved. The issue arose from incorrect handling of the bias, leading to miscalculations that could cause these operations to be incorrectly folded away. The fix adjusts the calculation to correctly incorporate the bias, ensuring accurate behavior, especially on targets like s390.

In Details

The gimple-fold pass incorrectly handled the bias parameter in len_load and len_store vector intrinsic operations. Historically, the operation was len - bias elements, but recent changes (r14-1932, r16-5984) in documentation and implementation led to len + bias being used, causing incorrect folding, particularly on s390. This patch corrects the calculation to len - bias and updates documentation in md.texi.

For Context
GIMPLE
GCC's Internal Representation optimized for the middle-end. It's a three-address-like code that is easier to optimize than the compiler's initial tree representation.
gimple-fold
An optimization pass in GCC that attempts to simplify or combine GIMPLE operations into simpler forms, often pre-calculating constant expressions.
optabs
Tables used by GCC backends to map generic operations to specific machine instructions. 'optabs' stand for 'operation tables'.
bias
A target-specific value (typically 0 or -1) used in vector load/store operations to adjust the number of elements being accessed.
vector intrinsic
Special functions or operations that allow direct manipulation of vector data types, often mapping to specific hardware instructions.
Filed Under: optimizationgimplevectorbackend