diff options
| -rw-r--r-- | polly/lib/CodeGen/BlockGenerators.cpp | 49 | 
1 files changed, 26 insertions, 23 deletions
| diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp index dc5d91ab9b0..ff7a35db537 100644 --- a/polly/lib/CodeGen/BlockGenerators.cpp +++ b/polly/lib/CodeGen/BlockGenerators.cpp @@ -63,30 +63,33 @@ Value *BlockGenerator::trySynthesizeNewValue(ScopStmt &Stmt, Value *Old,                                               ValueMapT &BBMap,                                               LoopToScevMapT <S,                                               Loop *L) const { -  if (SE.isSCEVable(Old->getType())) -    if (const SCEV *Scev = SE.getSCEVAtScope(Old, L)) { -      if (!isa<SCEVCouldNotCompute>(Scev)) { -        const SCEV *NewScev = apply(Scev, LTS, SE); -        ValueMapT VTV; -        VTV.insert(BBMap.begin(), BBMap.end()); -        VTV.insert(GlobalMap.begin(), GlobalMap.end()); - -        Scop &S = *Stmt.getParent(); -        const DataLayout &DL = -            S.getRegion().getEntry()->getParent()->getParent()->getDataLayout(); -        auto IP = Builder.GetInsertPoint(); - -        assert(IP != Builder.GetInsertBlock()->end() && -               "Only instructions can be insert points for SCEVExpander"); -        Value *Expanded = expandCodeFor(S, SE, DL, "polly", NewScev, -                                        Old->getType(), &*IP, &VTV); - -        BBMap[Old] = Expanded; -        return Expanded; -      } -    } +  if (!SE.isSCEVable(Old->getType())) +    return nullptr; -  return nullptr; +  const SCEV *Scev = SE.getSCEVAtScope(Old, L); +  if (!Scev) +    return nullptr; + +  if (isa<SCEVCouldNotCompute>(Scev)) +    return nullptr; + +  const SCEV *NewScev = apply(Scev, LTS, SE); +  ValueMapT VTV; +  VTV.insert(BBMap.begin(), BBMap.end()); +  VTV.insert(GlobalMap.begin(), GlobalMap.end()); + +  Scop &S = *Stmt.getParent(); +  const DataLayout &DL = +      S.getRegion().getEntry()->getParent()->getParent()->getDataLayout(); +  auto IP = Builder.GetInsertPoint(); + +  assert(IP != Builder.GetInsertBlock()->end() && +         "Only instructions can be insert points for SCEVExpander"); +  Value *Expanded = +      expandCodeFor(S, SE, DL, "polly", NewScev, Old->getType(), &*IP, &VTV); + +  BBMap[Old] = Expanded; +  return Expanded;  }  Value *BlockGenerator::getNewValue(ScopStmt &Stmt, Value *Old, ValueMapT &BBMap, | 

