Nikita Popov 349523e26b
[InstCombine] Merge constant offset geps across variable geps (#156326)
Fold:

    %gep1 = ptradd %p, C1
    %gep2 = ptradd %gep1, %x
    %res = ptradd %gep2, C2

To:

    %gep = ptradd %gep, %x
    %res = ptradd %gep, C1+C2

An alternative to this would be to generally canonicalize constant
offset GEPs to the right. I found the results of doing that somewhat
mixed, so I'm going for this more obviously beneficial change for now.

Proof for flag preservation on reassociation:
https://alive2.llvm.org/ce/z/gmpAMg
2025-09-03 10:47:32 +02:00
..
2024-07-01 14:52:06 +02:00

This directory contains test cases for the instcombine transformation.  The
dated tests are actual bug tests, whereas the named tests are used to test
for features that the this pass should be capable of performing.