[llvm] [SelectionDAG] Fix unsafe cases for loop.dependence.{war/raw}.mask (PR #168565)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 4 08:57:51 PST 2025
================
@@ -1569,8 +1569,21 @@ enum NodeType {
GET_ACTIVE_LANE_MASK,
// The `llvm.loop.dependence.{war, raw}.mask` intrinsics
- // Operands: Load pointer, Store pointer, Element size
+ // Operands: Load pointer, Store pointer, Element size, Lane offset
// Output: Mask
+ //
+ // Note: The semantics of these opcodes differ slightly from the intrinsics.
+ // Wherever "lane" (meaning lane index) occurs in the intrinsic definition, it
+ // is replaced with (lane + lane_offset) for the ISD opcode.
+ //
+ // E.g., for LOOP_DEPENDENCE_WAR_MASK:
+ // `(ptrB - ptrA) >= elementSize * lane`
+ // Becomes:
+ // `(ptrB - ptrA) >= elementSize * (lane + lane_offset)`
----------------
MacDue wrote:
I took this from the LangRef, but I think it might actually need to be:
```suggestion
// E.g., for LOOP_DEPENDENCE_WAR_MASK:
// `(ptrB - ptrA) > elementSize * lane`
// Becomes:
// `(ptrB - ptrA) > elementSize * (lane + lane_offset)`
```
Which I think matches whilewr (and the current lowering), I think the same may be true to the `.raw` mask.
https://github.com/llvm/llvm-project/pull/168565
More information about the llvm-commits
mailing list