[llvm] [SimplifyCFG] Preserve AA metadata when speculating stores (PR #227034)
Hari Limaye via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 30 02:04:26 PDT 2026
================
@@ -3418,8 +3429,21 @@ bool SimplifyCFGOpt::speculativelyExecuteBB(CondBrInst *BI,
for (auto &I : make_early_inc_range(*ThenBB)) {
if (!SpeculatedStoreValue || &I != SpeculatedStore) {
I.dropLocation();
+ I.dropUBImplyingAttrsAndMetadata();
+ } else {
+ // combineAAMetadata() made these safe on both paths above. Keep the
+ // resulting intersection while dropping all other UB-implying metadata.
+ static constexpr unsigned AAMetadata[] = {
----------------
hazzlim wrote:
Good point - I've refactored to use `AAMDNodes::merge` instead, which is a bit neater and a lot less magic
https://github.com/llvm/llvm-project/pull/227034
More information about the llvm-commits
mailing list