Issue 209022
Summary [InstCombine] Select-to-masked.load fold drops metadata
Labels new issue
Assignees
Reporter RonDahan101
    The  select(mask, masked.load(ptr, mask, passthrough), val) → masked.load(ptr, mask, val)  fold introduced in [#160522](https://github.com/llvm/llvm-project/pull/160522) (commit eb8589987267) 
creates a new  masked.load  via  Builder.CreateMaskedLoad()  without copying metadata from the original instruction.

This causes  !tbaa ,  !alias.scope ,  !noalias , and any other metadata on the original  masked.load  to be silently dropped, leading to incorrect alias analysis results downstream.

The fix is to call  copyMetadata  from the original instruction onto the newly created one.

reproduce: https://compiler-explorer.com/z/dT7EoG17n

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to