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

Iris Shi via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 4 07:55:40 PDT 2025


https://github.com/el-ev created https://github.com/llvm/llvm-project/pull/151981

We can creating disjoint or in IRBuilder since #146350.

>From 35838ed4c143817fc86a54442639e1a7b47bd0dc Mon Sep 17 00:00:00 2001
From: Iris Shi <0.0 at owo.li>
Date: Mon, 4 Aug 2025 22:46:46 +0800
Subject: [PATCH] [RISCV] Create disjoint or in RISCVGatherScatterLowering

---
 llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

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;



More information about the llvm-commits mailing list