diff options
author | Nikita Popov <npopov@redhat.com> | 2024-05-31 09:25:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-31 09:25:38 +0200 |
commit | e1cc9e4eaddcc295b4e775512e33b947b1514c17 (patch) | |
tree | 31344f58b4617f40fb9a5546c15cce66935c19e9 /llvm/lib/Object/ELFObjectFile.cpp | |
parent | 63dc31b68b78bc0e5deef21b98cab72de997c471 (diff) | |
download | llvm-e1cc9e4eaddcc295b4e775512e33b947b1514c17.zip llvm-e1cc9e4eaddcc295b4e775512e33b947b1514c17.tar.gz llvm-e1cc9e4eaddcc295b4e775512e33b947b1514c17.tar.bz2 |
[ConstantFold] Remove non-trivial gep-of-gep fold (#93823)
This fold is subtly incorrect, because DL-unaware constant folding does
not know the correct index type to use, and just performs the addition
in the type that happens to already be there. This is incorrect, since
sext(X)+sext(Y) is generally not the same as sext(X+Y). See the
`@constexpr_gep_of_gep_with_narrow_type()` for a miscompile with the
current implementation.
One could try to restrict the fold to cases where no overflow occurs,
but I'm not bothering with that here, because the DL-aware constant
folding will take care of this anyway. I've only kept the
straightforward zero-index case, where we just concatenate two GEPs.
Diffstat (limited to 'llvm/lib/Object/ELFObjectFile.cpp')
0 files changed, 0 insertions, 0 deletions