[llvm] [CodeGenPrepare] Resolve TODO: Treat disjoint-or as an add (PR #88667)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 14 09:57:08 PDT 2024
https://github.com/AtariDreams created https://github.com/llvm/llvm-project/pull/88667
Because we can treat Or-disjoint as an add, this allows for better codegen preparation.
>From 3106364fe49a7f917bee26748a32daca2a6cf0b7 Mon Sep 17 00:00:00 2001
From: Rose <gfunni234 at gmail.com>
Date: Sun, 14 Apr 2024 12:31:10 -0400
Subject: [PATCH] [CodeGenPrepare] Resolve TODO: Treat disjoint-or as an add
Because we can treat Or-disjoint as an add, this allows for better codegen preparation.
---
llvm/lib/CodeGen/CodeGenPrepare.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 22dbb3198a9f17..f0f82b1b03f8dd 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -4851,6 +4851,10 @@ bool AddressingModeMatcher::matchOperationAddr(User *AddrInst, unsigned Opcode,
return matchAddr(AddrInst->getOperand(0), Depth);
return false;
}
+ case Instruction::Or:
+ if (!cast<PossiblyDisjointInst>(AddrInst)->isDisjoint())
+ break;
+ [[fallthrough]];
case Instruction::Add: {
// Check to see if we can merge in one operand, then the other. If so, we
// win.
@@ -4891,9 +4895,6 @@ bool AddressingModeMatcher::matchOperationAddr(User *AddrInst, unsigned Opcode,
TPT.rollback(LastKnownGood);
break;
}
- // case Instruction::Or:
- // TODO: We can handle "Or Val, Imm" iff this OR is equivalent to an ADD.
- // break;
case Instruction::Mul:
case Instruction::Shl: {
// Can only handle X*C and X << C.
More information about the llvm-commits
mailing list