[ConstraintElim] Use collectOffset result for chained gep support.
authorFlorian Hahn <flo@fhahn.com>
Thu, 1 Dec 2022 17:01:07 +0000 (17:01 +0000)
committerFlorian Hahn <flo@fhahn.com>
Thu, 1 Dec 2022 17:01:07 +0000 (17:01 +0000)
commitee605b0acccea92bb2375921955008e1d6ca22d2
treebb666cfc433905d6c0d210136e16ddf1a55dc72f
parent319f0221eef90734a7b5fc719df07e3d5c693105
[ConstraintElim] Use collectOffset result for chained gep support.

This slightly simplifies the code and addresses a correctness issue
where the index scaling for the precondition was not considered
properly.

Thanks to @nikic for pointing that out in D137840.
llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
llvm/test/Transforms/ConstraintElimination/gep-add-multiple-indices.ll
llvm/test/Transforms/ConstraintElimination/gep-sub.ll