[all-commits] [llvm/llvm-project] c103f5: [InstCombine] Combine opaque pointer GEPs with mis...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Wed Apr 27 00:36:54 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c103f5e9da496866f2834a76709ae3a78054bb3f
https://github.com/llvm/llvm-project/commit/c103f5e9da496866f2834a76709ae3a78054bb3f
Author: Nikita Popov <npopov at redhat.com>
Date: 2022-04-27 (Wed, 27 Apr 2022)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
M llvm/test/Transforms/InstCombine/opaque-ptr.ll
Log Message:
-----------
[InstCombine] Combine opaque pointer GEPs with mismatching element types
Currently, two GEPs will only be combined if the result element
type of one is the same as the source element type of the other.
However, this means we may miss folding opportunities where the
second GEP could be rewritten using a different element type. This
is especially relevant for opaque pointers, where constant GEPs
often use i8 element type.
Address this by converting GEP indices to offsets, adding them,
and then converting them back to indices. The first (inner) GEP
is allowed to have variable indices as well, in which case only
the constant suffix is converted into an offset.
This should address the regression reported in
https://reviews.llvm.org/D123300#3467615.
Differential Revision: https://reviews.llvm.org/D124459
More information about the All-commits
mailing list