[llvm] [InstCombine] Preserve all load metadata when folding load of select (PR #206663)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 23:56:46 PDT 2026


ayrai-gb wrote:

Thanks for the review.

You're right: the two loads are hoisted above the `select` and execute unconditionally, so UB-implying metadata cannot be propagated. The existing poison-only copy is therefore correct, since poison on the untaken arm is discarded by the `select`.

Per the speculation-safe allowlist in `dropUBImplyingAttrsAndMetadata`, the only additional metadata kinds that seem potentially preservable here are `!fpmath`, `!prof`, `!mem_cache_hint`, and `!annotation`. Do you think it's worth a small follow-up to preserve any of those additional speculation-safe metadata kinds or I can close this PR as the current behavior appears to be correct.


https://github.com/llvm/llvm-project/pull/206663


More information about the llvm-commits mailing list