Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 8cad260

Browse files
arpilipecachemeifyoucan
authored andcommitted
Revert -r278267 [ValueTracking] An improvement to IR ValueTracking on Non-negative Integers
This change cause performance regression on MultiSource/Benchmarks/TSVC/Symbolics-flt/Symbolics-flt from LNT and some other bechmarks. See https://reviews.llvm.org/D18777 for details. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279433 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 4a44e0d commit 8cad260

File tree

2 files changed

+2
-38
lines changed

2 files changed

+2
-38
lines changed

lib/Analysis/ValueTracking.cpp

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,9 +1258,7 @@ static void computeKnownBitsFromOperator(const Operator *I, APInt &KnownZero,
12581258
unsigned Opcode = LU->getOpcode();
12591259
// Check for operations that have the property that if
12601260
// both their operands have low zero bits, the result
1261-
// will have low zero bits. Also check for operations
1262-
// that are known to produce non-negative or negative
1263-
// recurrence values.
1261+
// will have low zero bits.
12641262
if (Opcode == Instruction::Add ||
12651263
Opcode == Instruction::Sub ||
12661264
Opcode == Instruction::And ||
@@ -1286,40 +1284,6 @@ static void computeKnownBitsFromOperator(const Operator *I, APInt &KnownZero,
12861284
KnownZero = APInt::getLowBitsSet(BitWidth,
12871285
std::min(KnownZero2.countTrailingOnes(),
12881286
KnownZero3.countTrailingOnes()));
1289-
1290-
auto *OverflowOp = dyn_cast<OverflowingBinaryOperator>(LU);
1291-
if (OverflowOp && OverflowOp->hasNoSignedWrap()) {
1292-
// If initial value of recurrence is nonnegative, and we are adding
1293-
// a nonnegative number with nsw, the result can only be nonnegative
1294-
// or poison value regardless of the number of times we execute the
1295-
// add in phi recurrence. If initial value is negative and we are
1296-
// adding a negative number with nsw, the result can only be
1297-
// negative or poison value. Similar arguments apply to sub and mul.
1298-
//
1299-
// (add non-negative, non-negative) --> non-negative
1300-
// (add negative, negative) --> negative
1301-
if (Opcode == Instruction::Add) {
1302-
if (KnownZero2.isNegative() && KnownZero3.isNegative())
1303-
KnownZero.setBit(BitWidth - 1);
1304-
else if (KnownOne2.isNegative() && KnownOne3.isNegative())
1305-
KnownOne.setBit(BitWidth - 1);
1306-
}
1307-
1308-
// (sub nsw non-negative, negative) --> non-negative
1309-
// (sub nsw negative, non-negative) --> negative
1310-
else if (Opcode == Instruction::Sub && LL == I) {
1311-
if (KnownZero2.isNegative() && KnownOne3.isNegative())
1312-
KnownZero.setBit(BitWidth - 1);
1313-
else if (KnownOne2.isNegative() && KnownZero3.isNegative())
1314-
KnownOne.setBit(BitWidth - 1);
1315-
}
1316-
1317-
// (mul nsw non-negative, non-negative) --> non-negative
1318-
else if (Opcode == Instruction::Mul && KnownZero2.isNegative() &&
1319-
KnownZero3.isNegative())
1320-
KnownZero.setBit(BitWidth - 1);
1321-
}
1322-
13231287
break;
13241288
}
13251289
}

test/Transforms/BBVectorize/loop1.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ for.body: ; preds = %for.body, %entry
8383
; CHECK-UNRL: %add12 = fadd <2 x double> %add7, %mul11
8484
; CHECK-UNRL: %4 = bitcast double* %arrayidx14 to <2 x double>*
8585
; CHECK-UNRL: store <2 x double> %add12, <2 x double>* %4, align 8
86-
; CHECK-UNRL: %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
86+
; CHECK-UNRL: %indvars.iv.next.1 = add nsw i64 %indvars.iv, 2
8787
; CHECK-UNRL: %lftr.wideiv.1 = trunc i64 %indvars.iv.next.1 to i32
8888
; CHECK-UNRL: %exitcond.1 = icmp eq i32 %lftr.wideiv.1, 10
8989
; CHECK-UNRL: br i1 %exitcond.1, label %for.end, label %for.body

0 commit comments

Comments
 (0)