From e50a960c5ad3fd84ea7ab2a491b0f73f436f4196 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 18 May 2009 16:03:58 +0000 Subject: [PATCH] Fix ScalarEvolution::isLoopGuardedByCond to accept a null Loop*, for consistency with other routines that use a null Loop* to mean code not contained by any loop. llvm-svn: 72008 --- lib/Analysis/ScalarEvolution.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 30d6e7088c8..c53ec8a5f1a 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -3328,6 +3328,10 @@ ScalarEvolution::getPredecessorWithUniqueSuccessorForBB(BasicBlock *BB) { bool ScalarEvolution::isLoopGuardedByCond(const Loop *L, ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS) { + // Interpret a null as meaning no loop, where there is obviously no guard + // (interprocedural conditions notwithstanding). + if (!L) return false; + BasicBlock *Predecessor = getLoopPredecessor(L); BasicBlock *PredecessorDest = L->getHeader();