diff --git a/common.py b/common.py old mode 100644 new mode 100755 index be3e9526..2a788722 --- a/common.py +++ b/common.py @@ -121,4 +121,7 @@ def check_tools(m): if int(t11[j])input_tools[t][0][j]: + break return ret diff --git a/opt.cpp b/opt.cpp index ff7ee410..f70e522d 100644 --- a/opt.cpp +++ b/opt.cpp @@ -514,11 +514,31 @@ Optimize(llvm::Module *module, int optLevel) { llvm::initializeInstrumentation(*registry); llvm::initializeTarget(*registry); - optPM.add(llvm::createGlobalDCEPass(), 200); + optPM.add(llvm::createGlobalDCEPass(), 185); + + // Setup to use LLVM default AliasAnalysis + // Ideally, we want call: + // llvm::PassManagerBuilder pm_Builder; + // pm_Builder.OptLevel = optLevel; + // pm_Builder.addInitialAliasAnalysisPasses(optPM); + // but the addInitialAliasAnalysisPasses() is a private function + // so we explicitly enable them here. + // Need to keep sync with future LLVM change + // An alternative is to call populateFunctionPassManager() + optPM.add(llvm::createTypeBasedAliasAnalysisPass(), 190); + optPM.add(llvm::createBasicAliasAnalysisPass()); + optPM.add(llvm::createCFGSimplificationPass()); + // Here clang has an experimental pass SROAPass instead of + // ScalarReplAggregatesPass. We should add it in the future. + optPM.add(llvm::createScalarReplAggregatesPass()); + optPM.add(llvm::createEarlyCSEPass()); + optPM.add(llvm::createLowerExpectIntrinsicPass()); + optPM.add(llvm::createTypeBasedAliasAnalysisPass()); + optPM.add(llvm::createBasicAliasAnalysisPass()); // Early optimizations to try to reduce the total amount of code to // work with if we can - optPM.add(llvm::createReassociatePass()); + optPM.add(llvm::createReassociatePass(), 200); optPM.add(llvm::createConstantPropagationPass()); optPM.add(llvm::createDeadInstEliminationPass()); optPM.add(llvm::createCFGSimplificationPass());