[llvm] [RISCV] Create disjoint or in RISCVGatherScatterLowering (PR #151981)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 4 07:56:16 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-risc-v

Author: Iris Shi (el-ev)

<details>
<summary>Changes</summary>

We can creating disjoint or in IRBuilder since #<!-- -->146350.

---
Full diff: https://github.com/llvm/llvm-project/pull/151981.diff


1 Files Affected:

- (modified) llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp (+2-3) 


``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp b/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
index 82c0d8d4738a4..28567ada6c004 100644
--- a/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
@@ -167,9 +167,8 @@ static std::pair<Value *, Value *> matchStridedStart(Value *Start,
   default:
     llvm_unreachable("Unexpected opcode");
   case Instruction::Or:
-    // TODO: We'd be better off creating disjoint or here, but we don't yet
-    // have an IRBuilder API for that.
-    [[fallthrough]];
+    Start = Builder.CreateOr(Start, Splat, "", /* IsDisjoint = */ true);
+    break;
   case Instruction::Add:
     Start = Builder.CreateAdd(Start, Splat);
     break;

``````````

</details>


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


More information about the llvm-commits mailing list