Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Analysis/ScalarEvolution.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 7,234 Lines • ▼ Show 20 Lines | else if (GlobalAlias *GA = dyn_cast<GlobalAlias>(V)) { | ||||
return getUnknown(V); | return getUnknown(V); | ||||
} else if (!isa<ConstantExpr>(V)) | } else if (!isa<ConstantExpr>(V)) | ||||
return getUnknown(V); | return getUnknown(V); | ||||
Operator *U = cast<Operator>(V); | Operator *U = cast<Operator>(V); | ||||
if (auto BO = MatchBinaryOp(U, DT)) { | if (auto BO = MatchBinaryOp(U, DT)) { | ||||
bool IsConstArg = isa<ConstantInt>(BO->RHS); | bool IsConstArg = isa<ConstantInt>(BO->RHS); | ||||
switch (U->getOpcode()) { | switch (U->getOpcode()) { | ||||
case Instruction::Add: { | case Instruction::Add: | ||||
case Instruction::Mul: { | |||||
// For additions and multiplications, traverse add/mul chains for which we | // For additions and multiplications, traverse add/mul chains for which we | ||||
// can potentially create a single SCEV, to reduce the number of | // can potentially create a single SCEV, to reduce the number of | ||||
// get{Add,Mul}Expr calls. | // get{Add,Mul}Expr calls. | ||||
do { | do { | ||||
if (BO->Op) { | if (BO->Op) { | ||||
if (BO->Op != V && getExistingSCEV(BO->Op)) { | if (BO->Op != V && getExistingSCEV(BO->Op)) { | ||||
Ops.push_back(BO->Op); | Ops.push_back(BO->Op); | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
Ops.push_back(BO->RHS); | Ops.push_back(BO->RHS); | ||||
auto NewBO = MatchBinaryOp(BO->LHS, DT); | auto NewBO = MatchBinaryOp(BO->LHS, DT); | ||||
if (!NewBO || (NewBO->Opcode != Instruction::Add && | if (!NewBO || | ||||
NewBO->Opcode != Instruction::Sub)) { | (U->getOpcode() == Instruction::Add && | ||||
(NewBO->Opcode != Instruction::Add && | |||||
NewBO->Opcode != Instruction::Sub)) || | |||||
(U->getOpcode() == Instruction::Mul && | |||||
NewBO->Opcode != Instruction::Mul)) { | |||||
Ops.push_back(BO->LHS); | Ops.push_back(BO->LHS); | ||||
break; | break; | ||||
} | } | ||||
BO = NewBO; | // CreateSCEV calls getNoWrapFlagsFromUB, which under certain conditions | ||||
} while (true); | // requires a SCEV for the LHS. | ||||
return nullptr; | if (NewBO->Op && (NewBO->IsNSW || NewBO->IsNUW)) { | ||||
} | if (auto *I = dyn_cast<Instruction>(NewBO->Op); | ||||
frasercrmck: Correct me if I'm wrong but we're not yet able to use C++17 features. This is causing a build… | |||||
Not Done ReplyInline Actions@jreiffers what's the status of this? Does the commit need reverting? fhahn: @jreiffers what's the status of this? Does the commit need reverting? | |||||
This was fixed in https://reviews.llvm.org/rG3e9e43b48eb7a6a9b317e4c32ba0ee672630842b. jreiffers: This was fixed in https://reviews.llvm.org/rG3e9e43b48eb7a6a9b317e4c32ba0ee672630842b. | |||||
I && programUndefinedIfPoison(I)) { | |||||
case Instruction::Mul: { | |||||
do { | |||||
if (BO->Op) { | |||||
if (BO->Op != V && getExistingSCEV(BO->Op)) { | |||||
Ops.push_back(BO->Op); | |||||
break; | |||||
} | |||||
} | |||||
Ops.push_back(BO->RHS); | |||||
auto NewBO = MatchBinaryOp(BO->LHS, DT); | |||||
if (!NewBO || NewBO->Opcode != Instruction::Mul) { | |||||
Ops.push_back(BO->LHS); | Ops.push_back(BO->LHS); | ||||
break; | break; | ||||
} | } | ||||
} | |||||
BO = NewBO; | BO = NewBO; | ||||
} while (true); | } while (true); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
case Instruction::AShr: | case Instruction::AShr: | ||||
case Instruction::Shl: | case Instruction::Shl: | ||||
case Instruction::Xor: | case Instruction::Xor: | ||||
▲ Show 20 Lines • Show All 7,463 Lines • Show Last 20 Lines |
Correct me if I'm wrong but we're not yet able to use C++17 features. This is causing a build bot failure: https://lab.llvm.org/buildbot#builders/77/builds/20381