[all-commits] [llvm/llvm-project] 8cdca9: [GVN] Adjust metadata for coerced load CSE
Nikita Popov via All-commits
all-commits at lists.llvm.org
Mon Apr 17 03:52:47 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8cdca966902a5af9c28b5f6fb8602b22a07808a1
https://github.com/llvm/llvm-project/commit/8cdca966902a5af9c28b5f6fb8602b22a07808a1
Author: Nikita Popov <npopov at redhat.com>
Date: 2023-04-17 (Mon, 17 Apr 2023)
Changed paths:
M llvm/lib/Transforms/Scalar/GVN.cpp
M llvm/test/Transforms/GVN/metadata.ll
Log Message:
-----------
[GVN] Adjust metadata for coerced load CSE
When reusing a load in a way that requires coercion (i.e. casts or
bit extraction) we currently fail to adjust metadata. Unfortunately,
none of our existing tooling for this is really suitable, because
combineMetadataForCSE() expects both loads to have the same type.
In this case we may work on loads of different types and possibly
offset memory location.
As such, what this patch does is to simply drop all metadata, with
the following exceptions:
* Metadata for which violation is known to always cause UB.
* If the load is !noundef, keep all metadata, as this will turn
poison-generating metadata into UB as well.
This fixes the miscompile that was exposed by D146629.
Differential Revision: https://reviews.llvm.org/D148129
More information about the All-commits
mailing list