diff options
author | Hal Finkel <hfinkel@anl.gov> | 2016-12-15 03:02:15 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2016-12-15 03:02:15 +0000 |
commit | 3ca4a6bcf11d6b4ac34fed640f3ab23995ec1877 (patch) | |
tree | 4594d31d24d9535dd4f5198505a25dd88c0f8fb5 /llvm/lib/Transforms/Utils/InlineFunction.cpp | |
parent | cb9f78e1c3951337de4ba24902eced2c72184319 (diff) | |
download | bcm5719-llvm-3ca4a6bcf11d6b4ac34fed640f3ab23995ec1877.tar.gz bcm5719-llvm-3ca4a6bcf11d6b4ac34fed640f3ab23995ec1877.zip |
Remove the AssumptionCache
After r289755, the AssumptionCache is no longer needed. Variables affected by
assumptions are now found by using the new operand-bundle-based scheme. This
new scheme is more computationally efficient, and also we need much less
code...
llvm-svn: 289756
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/InlineFunction.cpp | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index ee083f91c7a..2c0597ef981 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -19,7 +19,6 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Analysis/AliasAnalysis.h" -#include "llvm/Analysis/AssumptionCache.h" #include "llvm/Analysis/CallGraph.h" #include "llvm/Analysis/CaptureTracking.h" #include "llvm/Analysis/EHPersonalities.h" @@ -1095,11 +1094,8 @@ static void AddAliasScopeMetadata(CallSite CS, ValueToValueMapTy &VMap, /// If the inlined function has non-byval align arguments, then /// add @llvm.assume-based alignment assumptions to preserve this information. static void AddAlignmentAssumptions(CallSite CS, InlineFunctionInfo &IFI) { - if (!PreserveAlignmentAssumptions || !IFI.GetAssumptionCache) + if (!PreserveAlignmentAssumptions) return; - AssumptionCache *AC = IFI.GetAssumptionCache - ? &(*IFI.GetAssumptionCache)(*CS.getCaller()) - : nullptr; auto &DL = CS.getCaller()->getParent()->getDataLayout(); // To avoid inserting redundant assumptions, we should check for assumptions @@ -1122,13 +1118,11 @@ static void AddAlignmentAssumptions(CallSite CS, InlineFunctionInfo &IFI) { // If we can already prove the asserted alignment in the context of the // caller, then don't bother inserting the assumption. Value *Arg = CS.getArgument(I->getArgNo()); - if (getKnownAlignment(Arg, DL, CS.getInstruction(), AC, &DT) >= Align) + if (getKnownAlignment(Arg, DL, CS.getInstruction(), &DT) >= Align) continue; - CallInst *NewAssumption = IRBuilder<>(CS.getInstruction()) - .CreateAlignmentAssumption(DL, Arg, Align); - if (AC) - AC->registerAssumption(NewAssumption); + IRBuilder<>(CS.getInstruction()) + .CreateAlignmentAssumption(DL, Arg, Align); } } } @@ -1239,13 +1233,11 @@ static Value *HandleByValArgument(Value *Arg, Instruction *TheCall, if (ByValAlignment <= 1) // 0 = unspecified, 1 = no particular alignment. return Arg; - AssumptionCache *AC = - IFI.GetAssumptionCache ? &(*IFI.GetAssumptionCache)(*Caller) : nullptr; const DataLayout &DL = Caller->getParent()->getDataLayout(); // If the pointer is already known to be sufficiently aligned, or if we can // round it up to a larger alignment, then we don't need a temporary. - if (getOrEnforceKnownAlignment(Arg, ByValAlignment, DL, TheCall, AC) >= + if (getOrEnforceKnownAlignment(Arg, ByValAlignment, DL, TheCall) >= ByValAlignment) return Arg; @@ -1661,16 +1653,6 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI, // Propagate llvm.mem.parallel_loop_access if necessary. PropagateParallelLoopAccessMetadata(CS, VMap); - - // Register any cloned assumptions. - if (IFI.GetAssumptionCache) - for (BasicBlock &NewBlock : - make_range(FirstNewBlock->getIterator(), Caller->end())) - for (Instruction &I : NewBlock) { - if (auto *II = dyn_cast<IntrinsicInst>(&I)) - if (II->getIntrinsicID() == Intrinsic::assume) - (*IFI.GetAssumptionCache)(*Caller).registerAssumption(II); - } } // If there are any alloca instructions in the block that used to be the entry @@ -2191,10 +2173,8 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI, // the entries are the same or undef). If so, remove the PHI so it doesn't // block other optimizations. if (PHI) { - AssumptionCache *AC = - IFI.GetAssumptionCache ? &(*IFI.GetAssumptionCache)(*Caller) : nullptr; auto &DL = Caller->getParent()->getDataLayout(); - if (Value *V = SimplifyInstruction(PHI, DL, nullptr, nullptr, AC)) { + if (Value *V = SimplifyInstruction(PHI, DL, nullptr, nullptr)) { PHI->replaceAllUsesWith(V); PHI->eraseFromParent(); } |