1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

[SCEVExpander] Clang format expressions; NFC

The boolean expressions are somewhat hard to read otherwise.

llvm-svn: 268998
This commit is contained in:
Sanjoy Das 2016-05-10 00:32:31 +00:00
parent 5e39b474b8
commit ed0c9c71c4

View File

@ -1777,8 +1777,8 @@ unsigned SCEVExpander::replaceCongruentIVs(Loop *L, const DominatorTree *DT,
PHINode *&OrigPhiRef = ExprToIVMap[SE.getSCEV(Phi)]; PHINode *&OrigPhiRef = ExprToIVMap[SE.getSCEV(Phi)];
if (!OrigPhiRef) { if (!OrigPhiRef) {
OrigPhiRef = Phi; OrigPhiRef = Phi;
if (Phi->getType()->isIntegerTy() && TTI if (Phi->getType()->isIntegerTy() && TTI &&
&& TTI->isTruncateFree(Phi->getType(), Phis.back()->getType())) { TTI->isTruncateFree(Phi->getType(), Phis.back()->getType())) {
// This phi can be freely truncated to the narrowest phi type. Map the // This phi can be freely truncated to the narrowest phi type. Map the
// truncated expression to it so it will be reused for narrow types. // truncated expression to it so it will be reused for narrow types.
const SCEV *TruncExpr = const SCEV *TruncExpr =
@ -1802,11 +1802,11 @@ unsigned SCEVExpander::replaceCongruentIVs(Loop *L, const DominatorTree *DT,
// If this phi has the same width but is more canonical, replace the // If this phi has the same width but is more canonical, replace the
// original with it. As part of the "more canonical" determination, // original with it. As part of the "more canonical" determination,
// respect a prior decision to use an IV chain. // respect a prior decision to use an IV chain.
if (OrigPhiRef->getType() == Phi->getType() if (OrigPhiRef->getType() == Phi->getType() &&
&& !(ChainedPhis.count(Phi) !(ChainedPhis.count(Phi) ||
|| isExpandedAddRecExprPHI(OrigPhiRef, OrigInc, L)) isExpandedAddRecExprPHI(OrigPhiRef, OrigInc, L)) &&
&& (ChainedPhis.count(Phi) (ChainedPhis.count(Phi) ||
|| isExpandedAddRecExprPHI(Phi, IsomorphicInc, L))) { isExpandedAddRecExprPHI(Phi, IsomorphicInc, L))) {
std::swap(OrigPhiRef, Phi); std::swap(OrigPhiRef, Phi);
std::swap(OrigInc, IsomorphicInc); std::swap(OrigInc, IsomorphicInc);
} }
@ -1818,14 +1818,13 @@ unsigned SCEVExpander::replaceCongruentIVs(Loop *L, const DominatorTree *DT,
// cycles that had postinc uses. // cycles that had postinc uses.
const SCEV *TruncExpr = SE.getTruncateOrNoop(SE.getSCEV(OrigInc), const SCEV *TruncExpr = SE.getTruncateOrNoop(SE.getSCEV(OrigInc),
IsomorphicInc->getType()); IsomorphicInc->getType());
if (OrigInc != IsomorphicInc if (OrigInc != IsomorphicInc && TruncExpr == SE.getSCEV(IsomorphicInc) &&
&& TruncExpr == SE.getSCEV(IsomorphicInc) SE.LI.replacementPreservesLCSSAForm(IsomorphicInc, OrigInc) &&
&& SE.LI.replacementPreservesLCSSAForm(IsomorphicInc, OrigInc) ((isa<PHINode>(OrigInc) && isa<PHINode>(IsomorphicInc)) ||
&& ((isa<PHINode>(OrigInc) && isa<PHINode>(IsomorphicInc)) hoistIVInc(OrigInc, IsomorphicInc))) {
|| hoistIVInc(OrigInc, IsomorphicInc))) { DEBUG_WITH_TYPE(DebugType,
DEBUG_WITH_TYPE(DebugType, dbgs() dbgs() << "INDVARS: Eliminated congruent iv.inc: "
<< "INDVARS: Eliminated congruent iv.inc: " << *IsomorphicInc << '\n');
<< *IsomorphicInc << '\n');
Value *NewInc = OrigInc; Value *NewInc = OrigInc;
if (OrigInc->getType() != IsomorphicInc->getType()) { if (OrigInc->getType() != IsomorphicInc->getType()) {
Instruction *IP = nullptr; Instruction *IP = nullptr;
@ -1843,8 +1842,8 @@ unsigned SCEVExpander::replaceCongruentIVs(Loop *L, const DominatorTree *DT,
DeadInsts.emplace_back(IsomorphicInc); DeadInsts.emplace_back(IsomorphicInc);
} }
} }
DEBUG_WITH_TYPE(DebugType, dbgs() DEBUG_WITH_TYPE(DebugType, dbgs() << "INDVARS: Eliminated congruent iv: "
<< "INDVARS: Eliminated congruent iv: " << *Phi << '\n'); << *Phi << '\n');
++NumElim; ++NumElim;
Value *NewIV = OrigPhiRef; Value *NewIV = OrigPhiRef;
if (OrigPhiRef->getType() != Phi->getType()) { if (OrigPhiRef->getType() != Phi->getType()) {