[llvm-branch-commits] [llvm] 6a7fc3e - Foo
Florian Hahn via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Jun 11 06:30:47 PDT 2021
Author: Florian Hahn
Date: 2021-06-11T14:06:37+01:00
New Revision: 6a7fc3e02d1fcf08189cbf87091967845557c4fe
URL: https://github.com/llvm/llvm-project/commit/6a7fc3e02d1fcf08189cbf87091967845557c4fe
DIFF: https://github.com/llvm/llvm-project/commit/6a7fc3e02d1fcf08189cbf87091967845557c4fe.diff
LOG: Foo
Added:
Modified:
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/LoopAccessAnalysis/reverse-memcheck-bounds.ll
llvm/test/Transforms/IndVarSimplify/eliminate-exit-no-dl.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 275fad4acb2b2..7484ce67c2f26 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -2406,6 +2406,28 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops,
"SCEVAddExpr operand types don't match!");
#endif
+ if (Ops.size() == 2 && isa<SCEVConstant>(Ops[1])) {
+ auto *AddExpr = dyn_cast<SCEVAddExpr>(Ops[0]);
+ if (AddExpr && isa<SCEVConstant>(AddExpr->getOperand(0))) {
+ auto I1 = cast<SCEVConstant>(AddExpr->getOperand(0))->getAPInt();
+ auto I2 = cast<SCEVConstant>(Ops[1])->getAPInt();
+ if (I1.isNonNegative() && I2.isNegative() && I2.abs().ule(I1)) {
+ OrigFlags = AddExpr->getNoWrapFlags();
+
+ }
+ }
+ }
+ if (Ops.size() == 2 && isa<SCEVConstant>(Ops[0])) {
+ auto *AddExpr = dyn_cast<SCEVAddExpr>(Ops[1]);
+ if (AddExpr && isa<SCEVConstant>(AddExpr->getOperand(0))) {
+ auto I1 = cast<SCEVConstant>(AddExpr->getOperand(0))->getAPInt();
+ auto I2 = cast<SCEVConstant>(Ops[0])->getAPInt();
+ if (I1.isNonNegative() && I2.isNegative() && I2.abs().ule(I1)) {
+ OrigFlags = AddExpr->getNoWrapFlags();
+
+ }
+ }
+ }
// Sort by complexity, this groups all similar expression types together.
GroupByComplexity(Ops, &LI, DT);
diff --git a/llvm/test/Analysis/LoopAccessAnalysis/reverse-memcheck-bounds.ll b/llvm/test/Analysis/LoopAccessAnalysis/reverse-memcheck-bounds.ll
index be51167dab8a9..84ee043b5c264 100644
--- a/llvm/test/Analysis/LoopAccessAnalysis/reverse-memcheck-bounds.ll
+++ b/llvm/test/Analysis/LoopAccessAnalysis/reverse-memcheck-bounds.ll
@@ -16,7 +16,7 @@ target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
target triple = "aarch64--linux-gnueabi"
; CHECK: function 'f':
-; CHECK: (Low: (20000 + %a) High: (60004 + %a))
+; CHECK: (Low: (20000 + %a)<nuw> High: (60004 + %a))
@B = common global i32* null, align 8
@A = common global i32* null, align 8
diff --git a/llvm/test/Transforms/IndVarSimplify/eliminate-exit-no-dl.ll b/llvm/test/Transforms/IndVarSimplify/eliminate-exit-no-dl.ll
index 0b1609b3096c6..0abfb06bfe2b0 100644
--- a/llvm/test/Transforms/IndVarSimplify/eliminate-exit-no-dl.ll
+++ b/llvm/test/Transforms/IndVarSimplify/eliminate-exit-no-dl.ll
@@ -17,8 +17,7 @@ define void @foo() {
; CHECK-NEXT: [[TMP:%.*]] = phi i8* [ [[TMP4:%.*]], [[BB7:%.*]] ], [ getelementptr inbounds ([0 x i8], [0 x i8]* @global, i64 0, i64 2), [[BB:%.*]] ]
; CHECK-NEXT: [[TMP4]] = getelementptr inbounds i8, i8* [[TMP]], i64 -1
; CHECK-NEXT: [[TMP6:%.*]] = load i8, i8* [[TMP4]], align 1
-; CHECK-NEXT: [[TMP5:%.*]] = icmp ugt i8* [[TMP4]], getelementptr inbounds ([0 x i8], [0 x i8]* @global, i64 0, i64 500)
-; CHECK-NEXT: br i1 [[TMP5]], label [[BB7]], label [[BB11:%.*]]
+; CHECK-NEXT: br i1 false, label [[BB7]], label [[BB11:%.*]]
; CHECK: bb7:
; CHECK-NEXT: [[TMP8:%.*]] = zext i8 [[TMP6]] to i64
; CHECK-NEXT: br i1 true, label [[BB11]], label [[BB3]]
More information about the llvm-branch-commits
mailing list