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

Commit 2be6538

Browse files
arpilipecachemeifyoucan
authored andcommitted
Revert -r278269 [IndVarSimplify] Eliminate zext of a signed IV when the IV is known to be non-negative
This change needs to be reverted in order to revert -r278267 which cause performance regression on MultiSource/Benchmarks/TSVC/Symbolics-flt/Symbolics-flt from LNT and some other bechmarks. See comments on https://reviews.llvm.org/D18777 for details. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279432 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent db16b4f commit 2be6538

File tree

2 files changed

+2
-89
lines changed

2 files changed

+2
-89
lines changed

lib/Transforms/Scalar/IndVarSimplify.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
3737
#include "llvm/Analysis/TargetLibraryInfo.h"
3838
#include "llvm/Analysis/TargetTransformInfo.h"
39-
#include "llvm/Analysis/ValueTracking.h"
4039
#include "llvm/IR/BasicBlock.h"
4140
#include "llvm/IR/CFG.h"
4241
#include "llvm/IR/Constants.h"
@@ -1290,8 +1289,7 @@ Instruction *WidenIV::widenIVUse(NarrowIVDefUse DU, SCEVExpander &Rewriter) {
12901289
}
12911290
}
12921291
// Our raison d'etre! Eliminate sign and zero extension.
1293-
if ((isa<SExtInst>(DU.NarrowUse) && (IsSigned || DU.NeverNegative)) ||
1294-
(isa<ZExtInst>(DU.NarrowUse) && (!IsSigned || DU.NeverNegative))) {
1292+
if (IsSigned ? isa<SExtInst>(DU.NarrowUse) : isa<ZExtInst>(DU.NarrowUse)) {
12951293
Value *NewDef = DU.WideDef;
12961294
if (DU.NarrowUse->getType() != WideType) {
12971295
unsigned CastWidth = SE->getTypeSizeInBits(DU.NarrowUse->getType());
@@ -1380,12 +1378,9 @@ Instruction *WidenIV::widenIVUse(NarrowIVDefUse DU, SCEVExpander &Rewriter) {
13801378
///
13811379
void WidenIV::pushNarrowIVUsers(Instruction *NarrowDef, Instruction *WideDef) {
13821380
const SCEV *NarrowSCEV = SE->getSCEV(NarrowDef);
1383-
// isKnownPredicate is enough for most cases but still need isKnownNonNegative
1384-
// here to work around conservatism in ScalarEvolution about no-wrap flags.
13851381
bool NeverNegative =
13861382
SE->isKnownPredicate(ICmpInst::ICMP_SGE, NarrowSCEV,
1387-
SE->getConstant(NarrowSCEV->getType(), 0)) ||
1388-
isKnownNonNegative(NarrowDef, NarrowDef->getModule()->getDataLayout());
1383+
SE->getConstant(NarrowSCEV->getType(), 0));
13891384
for (User *U : NarrowDef->users()) {
13901385
Instruction *NarrowUser = cast<Instruction>(U);
13911386

test/Transforms/IndVarSimplify/iv-widen-elim-ext.ll

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)