[llvm] r364228 - [CVP] Reenable nowrap flag inference
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 24 13:13:14 PDT 2019
Author: nikic
Date: Mon Jun 24 13:13:13 2019
New Revision: 364228
URL: http://llvm.org/viewvc/llvm-project?rev=364228&view=rev
Log:
[CVP] Reenable nowrap flag inference
Inference of nowrap flags in CVP has been disabled, because it
triggered a bug in LFTR (https://bugs.llvm.org/show_bug.cgi?id=31181).
This issue has been fixed in D60935, so we should be able to reenable
nowrap flag inference now.
Differential Revision: https://reviews.llvm.org/D62776
Modified:
llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
llvm/trunk/test/Transforms/CorrelatedValuePropagation/basic.ll
llvm/trunk/test/Transforms/CorrelatedValuePropagation/deopt.ll
llvm/trunk/test/Transforms/CorrelatedValuePropagation/icmp.ll
llvm/trunk/test/Transforms/CorrelatedValuePropagation/range.ll
Modified: llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp?rev=364228&r1=364227&r2=364228&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp Mon Jun 24 13:13:13 2019
@@ -66,7 +66,7 @@ STATISTIC(NumOverflows, "Number of overf
STATISTIC(NumSaturating,
"Number of saturating arithmetics converted to normal arithmetics");
-static cl::opt<bool> DontAddNoWrapFlags("cvp-dont-add-nowrap-flags", cl::init(true));
+static cl::opt<bool> DontAddNoWrapFlags("cvp-dont-add-nowrap-flags", cl::init(false));
namespace {
Modified: llvm/trunk/test/Transforms/CorrelatedValuePropagation/basic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/CorrelatedValuePropagation/basic.ll?rev=364228&r1=364227&r2=364228&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/CorrelatedValuePropagation/basic.ll (original)
+++ llvm/trunk/test/Transforms/CorrelatedValuePropagation/basic.ll Mon Jun 24 13:13:13 2019
@@ -463,7 +463,7 @@ define i1 @clamp_low1(i32 %a) {
; CHECK-NEXT: br i1 [[CMP]], label [[A_GUARD:%.*]], label [[OUT:%.*]]
; CHECK: a_guard:
; CHECK-NEXT: [[SEL_CMP:%.*]] = icmp eq i32 [[A]], 5
-; CHECK-NEXT: [[ADD:%.*]] = add i32 [[A]], -1
+; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[A]], -1
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[SEL_CMP]], i32 5, i32 [[A]]
; CHECK-NEXT: [[RES:%.*]] = icmp eq i32 [[SEL]], 4
; CHECK-NEXT: br label [[NEXT:%.*]]
@@ -495,7 +495,7 @@ define i1 @clamp_low2(i32 %a) {
; CHECK-NEXT: br i1 [[CMP]], label [[A_GUARD:%.*]], label [[OUT:%.*]]
; CHECK: a_guard:
; CHECK-NEXT: [[SEL_CMP:%.*]] = icmp ne i32 [[A]], 5
-; CHECK-NEXT: [[ADD:%.*]] = add i32 [[A]], -1
+; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[A]], -1
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[SEL_CMP]], i32 [[A]], i32 5
; CHECK-NEXT: [[RES:%.*]] = icmp eq i32 [[SEL]], 4
; CHECK-NEXT: br label [[NEXT:%.*]]
@@ -527,7 +527,7 @@ define i1 @clamp_high1(i32 %a) {
; CHECK-NEXT: br i1 [[CMP]], label [[A_GUARD:%.*]], label [[OUT:%.*]]
; CHECK: a_guard:
; CHECK-NEXT: [[SEL_CMP:%.*]] = icmp eq i32 [[A]], 5
-; CHECK-NEXT: [[ADD:%.*]] = add i32 [[A]], 1
+; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[A]], 1
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[SEL_CMP]], i32 5, i32 [[A]]
; CHECK-NEXT: [[RES:%.*]] = icmp eq i32 [[SEL]], 6
; CHECK-NEXT: br label [[NEXT:%.*]]
@@ -559,7 +559,7 @@ define i1 @clamp_high2(i32 %a) {
; CHECK-NEXT: br i1 [[CMP]], label [[A_GUARD:%.*]], label [[OUT:%.*]]
; CHECK: a_guard:
; CHECK-NEXT: [[SEL_CMP:%.*]] = icmp ne i32 [[A]], 5
-; CHECK-NEXT: [[ADD:%.*]] = add i32 [[A]], 1
+; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[A]], 1
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[SEL_CMP]], i32 [[A]], i32 5
; CHECK-NEXT: [[RES:%.*]] = icmp eq i32 [[SEL]], 6
; CHECK-NEXT: br label [[NEXT:%.*]]
@@ -592,7 +592,7 @@ define i1 @clamp_high3(i32 %a) {
; CHECK-NEXT: br i1 [[CMP]], label [[A_GUARD:%.*]], label [[OUT:%.*]]
; CHECK: a_guard:
; CHECK-NEXT: [[SEL_CMP:%.*]] = icmp ne i32 [[A]], 5
-; CHECK-NEXT: [[ADD:%.*]] = add i32 [[A]], 100
+; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[A]], 100
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[SEL_CMP]], i32 [[A]], i32 5
; CHECK-NEXT: [[RES:%.*]] = icmp eq i32 [[SEL]], 105
; CHECK-NEXT: br label [[NEXT:%.*]]
@@ -625,7 +625,7 @@ define void @abs1(i32 %a, i1* %p) {
; CHECK-NEXT: [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: br i1 [[AND]], label [[GUARD:%.*]], label [[EXIT:%.*]]
; CHECK: guard:
-; CHECK-NEXT: [[SUB:%.*]] = sub i32 0, [[A]]
+; CHECK-NEXT: [[SUB:%.*]] = sub nsw i32 0, [[A]]
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[A]], 0
; CHECK-NEXT: [[ABS:%.*]] = select i1 [[CMP]], i32 [[SUB]], i32 [[A]]
; CHECK-NEXT: br label [[SPLIT:%.*]]
@@ -675,7 +675,7 @@ define void @abs2(i32 %a, i1* %p) {
; CHECK-NEXT: [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: br i1 [[AND]], label [[GUARD:%.*]], label [[EXIT:%.*]]
; CHECK: guard:
-; CHECK-NEXT: [[SUB:%.*]] = sub i32 0, [[A]]
+; CHECK-NEXT: [[SUB:%.*]] = sub nsw i32 0, [[A]]
; CHECK-NEXT: [[CMP:%.*]] = icmp sge i32 [[A]], 0
; CHECK-NEXT: [[ABS:%.*]] = select i1 [[CMP]], i32 [[A]], i32 [[SUB]]
; CHECK-NEXT: br label [[SPLIT:%.*]]
@@ -725,7 +725,7 @@ define void @nabs1(i32 %a, i1* %p) {
; CHECK-NEXT: [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: br i1 [[AND]], label [[GUARD:%.*]], label [[EXIT:%.*]]
; CHECK: guard:
-; CHECK-NEXT: [[SUB:%.*]] = sub i32 0, [[A]]
+; CHECK-NEXT: [[SUB:%.*]] = sub nsw i32 0, [[A]]
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A]], 0
; CHECK-NEXT: [[NABS:%.*]] = select i1 [[CMP]], i32 [[SUB]], i32 [[A]]
; CHECK-NEXT: br label [[SPLIT:%.*]]
@@ -775,7 +775,7 @@ define void @nabs2(i32 %a, i1* %p) {
; CHECK-NEXT: [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
; CHECK-NEXT: br i1 [[AND]], label [[GUARD:%.*]], label [[EXIT:%.*]]
; CHECK: guard:
-; CHECK-NEXT: [[SUB:%.*]] = sub i32 0, [[A]]
+; CHECK-NEXT: [[SUB:%.*]] = sub nsw i32 0, [[A]]
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[A]], 0
; CHECK-NEXT: [[NABS:%.*]] = select i1 [[CMP]], i32 [[A]], i32 [[SUB]]
; CHECK-NEXT: br label [[SPLIT:%.*]]
Modified: llvm/trunk/test/Transforms/CorrelatedValuePropagation/deopt.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/CorrelatedValuePropagation/deopt.ll?rev=364228&r1=364227&r2=364228&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/CorrelatedValuePropagation/deopt.ll (original)
+++ llvm/trunk/test/Transforms/CorrelatedValuePropagation/deopt.ll Mon Jun 24 13:13:13 2019
@@ -118,8 +118,8 @@ define void @test4(i1 %c, i1 %c2) {
; CHECK-LABEL: @test4(
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[C:%.*]], i64 0, i64 1
; CHECK-NEXT: [[SEL2:%.*]] = select i1 [[C2:%.*]], i64 0, i64 1
-; CHECK-NEXT: [[ADD1:%.*]] = add i64 0, [[SEL]]
-; CHECK-NEXT: [[ADD2:%.*]] = add i64 [[ADD1]], [[SEL2]]
+; CHECK-NEXT: [[ADD1:%.*]] = add nuw nsw i64 0, [[SEL]]
+; CHECK-NEXT: [[ADD2:%.*]] = add nuw nsw i64 [[ADD1]], [[SEL2]]
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i64 [[ADD2]], 1
; CHECK-NEXT: br i1 [[CMP]], label [[TAKEN:%.*]], label [[UNTAKEN:%.*]]
; CHECK: taken:
Modified: llvm/trunk/test/Transforms/CorrelatedValuePropagation/icmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/CorrelatedValuePropagation/icmp.ll?rev=364228&r1=364227&r2=364228&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/CorrelatedValuePropagation/icmp.ll (original)
+++ llvm/trunk/test/Transforms/CorrelatedValuePropagation/icmp.ll Mon Jun 24 13:13:13 2019
@@ -93,7 +93,7 @@ define i1 @test3(i32 %x, i32 %y) #0 {
; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i32 [[Y:%.*]], 10
; CHECK-NEXT: br i1 [[CMP2]], label [[CONT2:%.*]], label [[OUT]]
; CHECK: cont2:
-; CHECK-NEXT: [[ADD:%.*]] = add i32 [[X]], [[Y]]
+; CHECK-NEXT: [[ADD:%.*]] = add nuw nsw i32 [[X]], [[Y]]
; CHECK-NEXT: br label [[CONT3:%.*]]
; CHECK: cont3:
; CHECK-NEXT: br label [[OUT]]
@@ -132,7 +132,7 @@ define i1 @test4(i32 %x, i32 %y) #0 {
; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i32 [[Y:%.*]], 10
; CHECK-NEXT: br i1 [[CMP2]], label [[CONT2:%.*]], label [[OUT]]
; CHECK: cont2:
-; CHECK-NEXT: [[ADD:%.*]] = add i32 [[X]], [[Y]]
+; CHECK-NEXT: [[ADD:%.*]] = add nuw nsw i32 [[X]], [[Y]]
; CHECK-NEXT: br label [[CONT3:%.*]]
; CHECK: cont3:
; CHECK-NEXT: [[CMP3:%.*]] = icmp ult i32 [[ADD]], 15
Modified: llvm/trunk/test/Transforms/CorrelatedValuePropagation/range.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/CorrelatedValuePropagation/range.ll?rev=364228&r1=364227&r2=364228&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/CorrelatedValuePropagation/range.ll (original)
+++ llvm/trunk/test/Transforms/CorrelatedValuePropagation/range.ll Mon Jun 24 13:13:13 2019
@@ -276,7 +276,7 @@ define i1 @test10(i64* %p) {
define i1 @test11() {
; CHECK-LABEL: @test11(
; CHECK-NEXT: [[POSITIVE:%.*]] = load i32, i32* @g, !range !3
-; CHECK-NEXT: [[ADD:%.*]] = add i32 [[POSITIVE]], 1
+; CHECK-NEXT: [[ADD:%.*]] = add nuw nsw i32 [[POSITIVE]], 1
; CHECK-NEXT: [[TEST:%.*]] = icmp sgt i32 [[ADD]], 0
; CHECK-NEXT: br label [[NEXT:%.*]]
; CHECK: next:
More information about the llvm-commits
mailing list