Make SROA and PredicateSimplifier cope if TargetData is not

available. This is very conservative for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79442 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2009-08-19 18:22:18 +00:00
parent 8255573835
commit e4af1cf402
2 changed files with 16 additions and 6 deletions

View File

@@ -2284,8 +2284,6 @@ namespace {
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequiredID(BreakCriticalEdgesID);
AU.addRequired<DominatorTree>();
AU.addRequired<TargetData>();
AU.addPreserved<TargetData>();
}
private:
@@ -2409,7 +2407,13 @@ namespace {
bool PredicateSimplifier::runOnFunction(Function &F) {
DominatorTree *DT = &getAnalysis<DominatorTree>();
DTDFS = new DomTreeDFS(DT);
TargetData *TD = &getAnalysis<TargetData>();
TargetData *TD = getAnalysisIfAvailable<TargetData>();
// FIXME: PredicateSimplifier should still be able to do basic
// optimizations without TargetData. But for now, just exit if
// it's not available.
if (!TD) return false;
Context = &F.getContext();
DEBUG(errs() << "Entering Function: " << F.getName() << "\n");