Index: llvm/trunk/include/llvm/IR/DiagnosticInfo.h =================================================================== --- llvm/trunk/include/llvm/IR/DiagnosticInfo.h +++ llvm/trunk/include/llvm/IR/DiagnosticInfo.h @@ -15,11 +15,13 @@ #ifndef LLVM_IR_DIAGNOSTICINFO_H #define LLVM_IR_DIAGNOSTICINFO_H +#include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" #include "llvm/IR/DebugLoc.h" -#include "llvm/IR/Module.h" -#include "llvm/Support/Casting.h" +#include "llvm/Support/CBindingWrapping.h" +#include "llvm-c/Types.h" #include +#include namespace llvm { @@ -27,9 +29,8 @@ class DiagnosticPrinter; class Function; class Instruction; -class LLVMContextImpl; -class Value; -class DebugLoc; +class LLVMContext; +class Module; class SMDiagnostic; /// \brief Defines the different supported severity of a diagnostic. @@ -91,7 +92,7 @@ DiagnosticInfo(/* DiagnosticKind */ int Kind, DiagnosticSeverity Severity) : Kind(Kind), Severity(Severity) {} - virtual ~DiagnosticInfo() {} + virtual ~DiagnosticInfo() = default; /* DiagnosticKind */ int getKind() const { return Kind; } DiagnosticSeverity getSeverity() const { return Severity; } @@ -617,7 +618,7 @@ const Twine &getMessage() const { return Msg; } - void print(DiagnosticPrinter &DP) const; + void print(DiagnosticPrinter &DP) const override; }; /// Emit a warning when loop vectorization is specified but fails. \p Fn is the @@ -632,6 +633,6 @@ void emitLoopInterleaveWarning(LLVMContext &Ctx, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg); -} // End namespace llvm +} // end namespace llvm -#endif +#endif // LLVM_IR_DIAGNOSTICINFO_H Index: llvm/trunk/include/llvm/IR/IRBuilder.h =================================================================== --- llvm/trunk/include/llvm/IR/IRBuilder.h +++ llvm/trunk/include/llvm/IR/IRBuilder.h @@ -16,22 +16,42 @@ #define LLVM_IR_IRBUILDER_H #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/None.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" #include "llvm/IR/BasicBlock.h" +#include "llvm/IR/Constant.h" #include "llvm/IR/ConstantFolder.h" +#include "llvm/IR/Constants.h" #include "llvm/IR/DataLayout.h" +#include "llvm/IR/DebugLoc.h" +#include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Function.h" #include "llvm/IR/GlobalVariable.h" +#include "llvm/IR/InstrTypes.h" +#include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Intrinsics.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Operator.h" +#include "llvm/IR/Type.h" +#include "llvm/IR/Value.h" #include "llvm/IR/ValueHandle.h" +#include "llvm/Support/AtomicOrdering.h" #include "llvm/Support/CBindingWrapping.h" +#include "llvm/Support/Casting.h" +#include "llvm-c/Types.h" +#include +#include +#include namespace llvm { -class StringRef; + +class APInt; class MDNode; +class Module; +class Use; /// \brief This provides the default implementation of the IRBuilder /// 'InsertHelper' method that is called whenever an instruction is created by @@ -435,12 +455,14 @@ Value *Mask); /// \brief Create a call to Masked Gather intrinsic - CallInst *CreateMaskedGather(Value *Ptrs, unsigned Align, Value *Mask = 0, - Value *PassThru = 0, const Twine& Name = ""); + CallInst *CreateMaskedGather(Value *Ptrs, unsigned Align, + Value *Mask = nullptr, + Value *PassThru = nullptr, + const Twine& Name = ""); /// \brief Create a call to Masked Scatter intrinsic CallInst *CreateMaskedScatter(Value *Val, Value *Ptrs, unsigned Align, - Value *Mask = 0); + Value *Mask = nullptr); /// \brief Create an assume intrinsic call that allows the optimizer to /// assume that the provided condition will be true. Index: llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h =================================================================== --- llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h +++ llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h @@ -68,6 +68,7 @@ // definitions, which would require multiple phis, and multiple memoryaccesses // per instruction. //===----------------------------------------------------------------------===// + #ifndef LLVM_TRANSFORMS_UTILS_MEMORYSSA_H #define LLVM_TRANSFORMS_UTILS_MEMORYSSA_H @@ -75,24 +76,41 @@ #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/ilist.h" #include "llvm/ADT/ilist_node.h" #include "llvm/ADT/iterator.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/MemoryLocation.h" #include "llvm/Analysis/PHITransAddr.h" +#include "llvm/IR/BasicBlock.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/Module.h" #include "llvm/IR/OperandTraits.h" #include "llvm/IR/Type.h" +#include "llvm/IR/Use.h" #include "llvm/IR/User.h" #include "llvm/IR/Value.h" #include "llvm/Pass.h" +#include "llvm/PassAnalysisSupport.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/ErrorHandling.h" +#include +#include +#include +#include +#include +#include namespace llvm { -class BasicBlock; + class DominatorTree; class Function; +class Instruction; class MemoryAccess; +class LLVMContext; +class raw_ostream; + template class memoryaccess_def_iterator_base; using memoryaccess_def_iterator = memoryaccess_def_iterator_base; using const_memoryaccess_def_iterator = @@ -113,7 +131,8 @@ return ID == MemoryUseVal || ID == MemoryPhiVal || ID == MemoryDefVal; } - virtual ~MemoryAccess(); + ~MemoryAccess() override; + BasicBlock *getBlock() const { return Block; } virtual void print(raw_ostream &OS) const = 0; @@ -214,6 +233,7 @@ private: Instruction *MemoryInst; }; + template <> struct OperandTraits : public FixedNumOperandTraits {}; @@ -250,6 +270,7 @@ llvm_unreachable("MemoryUses do not have IDs"); } }; + template <> struct OperandTraits : public FixedNumOperandTraits {}; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(MemoryUse, MemoryAccess) @@ -293,6 +314,7 @@ private: const unsigned ID; }; + template <> struct OperandTraits : public FixedNumOperandTraits {}; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(MemoryDef, MemoryAccess) @@ -447,7 +469,7 @@ /// For debugging only. This gets used to give memory accesses pretty numbers /// when printing them out - virtual unsigned getID() const final { return ID; } + unsigned getID() const final { return ID; } private: // For debugging only @@ -463,8 +485,8 @@ growHungoffUses(ReservedSpace, /* IsPhi */ true); } }; -template <> struct OperandTraits : public HungoffOperandTraits<2> {}; +template <> struct OperandTraits : public HungoffOperandTraits<2> {}; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(MemoryPhi, MemoryAccess) class MemorySSAWalker; @@ -674,6 +696,7 @@ /// starting from the use side of the memory def. virtual MemoryAccess *getClobberingMemoryAccess(MemoryAccess *, MemoryLocation &) = 0; + /// \brief Given a memory access, invalidate anything this walker knows about /// that access. /// This API is used by walkers that store information to perform basic cache @@ -733,7 +756,8 @@ class CachingMemorySSAWalker final : public MemorySSAWalker { public: CachingMemorySSAWalker(MemorySSA *, AliasAnalysis *, DominatorTree *); - virtual ~CachingMemorySSAWalker(); + ~CachingMemorySSAWalker() override; + MemoryAccess *getClobberingMemoryAccess(const Instruction *) override; MemoryAccess *getClobberingMemoryAccess(MemoryAccess *, MemoryLocation &) override; @@ -821,6 +845,7 @@ inline memoryaccess_def_iterator MemoryAccess::defs_begin() { return memoryaccess_def_iterator(this); } + inline const_memoryaccess_def_iterator MemoryAccess::defs_begin() const { return const_memoryaccess_def_iterator(this); } @@ -940,7 +965,9 @@ inline upward_defs_iterator upward_defs_begin(const MemoryAccessPair &Pair) { return upward_defs_iterator(Pair); } + inline upward_defs_iterator upward_defs_end() { return upward_defs_iterator(); } -} -#endif +} // end namespace llvm + +#endif // LLVM_TRANSFORMS_UTILS_MEMORYSSA_H Index: llvm/trunk/lib/IR/LLVMContext.cpp =================================================================== --- llvm/trunk/lib/IR/LLVMContext.cpp +++ llvm/trunk/lib/IR/LLVMContext.cpp @@ -13,16 +13,23 @@ //===----------------------------------------------------------------------===// #include "llvm/IR/LLVMContext.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/Twine.h" #include "LLVMContextImpl.h" -#include "llvm/IR/Constants.h" -#include "llvm/IR/DebugLoc.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/DiagnosticPrinter.h" -#include "llvm/IR/Instruction.h" #include "llvm/IR/Metadata.h" -#include "llvm/Support/ManagedStatic.h" -#include "llvm/Support/SourceMgr.h" -#include +#include "llvm/IR/Module.h" +#include "llvm/Support/Casting.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/raw_ostream.h" +#include +#include +#include +#include + using namespace llvm; LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) { @@ -142,6 +149,7 @@ "gc-transition operand bundle id drifted!"); (void)GCTransitionEntry; } + LLVMContext::~LLVMContext() { delete pImpl; } void LLVMContext::addModule(Module *M) { @@ -300,9 +308,11 @@ } It->second = std::move(GCName); } + const std::string &LLVMContext::getGC(const Function &Fn) { return pImpl->GCNames[&Fn]; } + void LLVMContext::deleteGC(const Function &Fn) { pImpl->GCNames.erase(&Fn); } Index: llvm/trunk/unittests/ProfileData/SampleProfTest.cpp =================================================================== --- llvm/trunk/unittests/ProfileData/SampleProfTest.cpp +++ llvm/trunk/unittests/ProfileData/SampleProfTest.cpp @@ -1,5 +1,4 @@ -//===- unittest/ProfileData/SampleProfTest.cpp -------------------*- C++ -//-*-===// +//===- unittest/ProfileData/SampleProfTest.cpp ------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -8,12 +7,27 @@ // //===----------------------------------------------------------------------===// +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/IR/LLVMContext.h" #include "llvm/IR/Metadata.h" +#include "llvm/IR/Module.h" +#include "llvm/ProfileData/ProfileCommon.h" +#include "llvm/ProfileData/SampleProf.h" #include "llvm/ProfileData/SampleProfReader.h" #include "llvm/ProfileData/SampleProfWriter.h" +#include "llvm/Support/Casting.h" +#include "llvm/Support/ErrorOr.h" +#include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/raw_ostream.h" #include "gtest/gtest.h" - -#include +#include +#include +#include +#include +#include +#include +#include using namespace llvm; using namespace sampleprof;