aboutsummaryrefslogtreecommitdiff
path: root/llvm
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2024-06-04 09:36:12 +0200
committerNikita Popov <npopov@redhat.com>2024-06-04 09:37:10 +0200
commit34b4112c909d6d5e177d0e6851af7db18058fb9a (patch)
treecd9a3f666ab358ace6e467c0368a1f94db97578f /llvm
parent6bc71bac8728b30b560f7ae210917072b01b8046 (diff)
downloadllvm-34b4112c909d6d5e177d0e6851af7db18058fb9a.zip
llvm-34b4112c909d6d5e177d0e6851af7db18058fb9a.tar.gz
llvm-34b4112c909d6d5e177d0e6851af7db18058fb9a.tar.bz2
[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.
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstructionCombining.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index eb48157..c34d1e5 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