[llvm] 34b4112 - [InstCombine] Simplify isMergedGEPInBounds() (NFCI)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 4 00:37:17 PDT 2024
Author: Nikita Popov
Date: 2024-06-04T09:37:10+02:00
New Revision: 34b4112c909d6d5e177d0e6851af7db18058fb9a
URL: https://github.com/llvm/llvm-project/commit/34b4112c909d6d5e177d0e6851af7db18058fb9a
DIFF: https://github.com/llvm/llvm-project/commit/34b4112c909d6d5e177d0e6851af7db18058fb9a.diff
LOG: [InstCombine] Simplify isMergedGEPInBounds() (NFCI)
Since the switch to opaque pointers, zero-index GEPs will be
optimized away anyway, so there is no need to explicitly handle
them here.
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index eb48157af009c..c34d1e5832ea1 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -2308,12 +2308,7 @@ Instruction *InstCombinerImpl::narrowMathIfNoOverflow(BinaryOperator &BO) {
}
static bool isMergedGEPInBounds(GEPOperator &GEP1, GEPOperator &GEP2) {
- // At least one GEP must be inbounds.
- if (!GEP1.isInBounds() && !GEP2.isInBounds())
- return false;
-
- return (GEP1.isInBounds() || GEP1.hasAllZeroIndices()) &&
- (GEP2.isInBounds() || GEP2.hasAllZeroIndices());
+ return GEP1.isInBounds() && GEP2.isInBounds();
}
/// Thread a GEP operation with constant indices through the constant true/false
More information about the llvm-commits
mailing list