[PATCH] D63170: [clang][NewPM] Fix broken -O0 test from missing assumptions
Leonard Chan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 11 14:44:21 PDT 2019
leonardchan created this revision.
leonardchan added reviewers: chandlerc, echristo, phosek, serge-sans-paille.
leonardchan added a project: clang.
Herald added subscribers: llvm-commits, hiraditya, eraman.
Herald added a project: LLVM.
leonardchan added a parent revision: D62225: [clang][NewPM] Fixing -O0 tests that are broken under new PM.
Add an AssumptionCache callback to the InlineFuntionInfo used for the AlwaysInlinerPass to match codegen of the AlwaysInlinerLegacyPass to generate llvm.assume. This fixes `CodeGen/builtin-movdir.c` when new PM is enabled by default.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D63170
Files:
llvm/lib/Transforms/IPO/AlwaysInliner.cpp
Index: llvm/lib/Transforms/IPO/AlwaysInliner.cpp
===================================================================
--- llvm/lib/Transforms/IPO/AlwaysInliner.cpp
+++ llvm/lib/Transforms/IPO/AlwaysInliner.cpp
@@ -31,8 +31,17 @@
#define DEBUG_TYPE "inline"
-PreservedAnalyses AlwaysInlinerPass::run(Module &M, ModuleAnalysisManager &) {
- InlineFunctionInfo IFI;
+PreservedAnalyses AlwaysInlinerPass::run(Module &M,
+ ModuleAnalysisManager &MAM) {
+ // Add inline assumptions during code generation.
+ FunctionAnalysisManager &FAM =
+ MAM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
+ std::function<AssumptionCache &(Function &)> GetAssumptionCache =
+ [&](Function &F) -> AssumptionCache & {
+ return FAM.getResult<AssumptionAnalysis>(F);
+ };
+ InlineFunctionInfo IFI(/*cg=*/nullptr, &GetAssumptionCache);
+
SmallSetVector<CallSite, 16> Calls;
bool Changed = false;
SmallVector<Function *, 16> InlinedFunctions;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63170.204170.patch
Type: text/x-patch
Size: 1005 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190611/1e60e2e1/attachment.bin>
More information about the cfe-commits
mailing list