Revert "Revert "Update Polly for the removal of PreserveNames from IRBuilder stuff""

This reverts commit r263322 and reapplies r263296. The original
r263258 was reapplied in LLVM after being reverted in r263321 due to
issues with Release testing in Clang.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 263399
This commit is contained in:
Mehdi Amini 2016-03-13 22:21:43 +00:00
parent cc232d1f90
commit 16c445ae92
1 changed files with 6 additions and 10 deletions

View File

@ -108,33 +108,29 @@ private:
/// ///
/// This is used to add additional items such as e.g. the llvm.loop.parallel /// This is used to add additional items such as e.g. the llvm.loop.parallel
/// metadata. /// metadata.
template <bool PreserveNames> class IRInserter : protected llvm::IRBuilderDefaultInserter {
class PollyBuilderInserter
: protected llvm::IRBuilderDefaultInserter<PreserveNames> {
public: public:
PollyBuilderInserter() : Annotator(0) {} IRInserter() = default;
PollyBuilderInserter(class ScopAnnotator &A) : Annotator(&A) {} IRInserter(class ScopAnnotator &A) : Annotator(&A) {}
protected: protected:
void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name, void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name,
llvm::BasicBlock *BB, llvm::BasicBlock *BB,
llvm::BasicBlock::iterator InsertPt) const { llvm::BasicBlock::iterator InsertPt) const {
llvm::IRBuilderDefaultInserter<PreserveNames>::InsertHelper(I, Name, BB, llvm::IRBuilderDefaultInserter::InsertHelper(I, Name, BB, InsertPt);
InsertPt);
if (Annotator) if (Annotator)
Annotator->annotate(I); Annotator->annotate(I);
} }
private: private:
class ScopAnnotator *Annotator; class ScopAnnotator *Annotator = nullptr;
}; };
// TODO: We should not name instructions in NDEBUG builds. // TODO: We should not name instructions in NDEBUG builds.
// //
// We currently always name instructions, as the polly test suite currently // We currently always name instructions, as the polly test suite currently
// matches for certain names. // matches for certain names.
typedef PollyBuilderInserter<true> IRInserter; typedef llvm::IRBuilder<llvm::ConstantFolder, IRInserter> PollyIRBuilder;
typedef llvm::IRBuilder<true, llvm::ConstantFolder, IRInserter> PollyIRBuilder;
/// @brief Return an IR builder pointed before the @p BB terminator. /// @brief Return an IR builder pointed before the @p BB terminator.
static inline PollyIRBuilder createPollyIRBuilder(llvm::BasicBlock *BB, static inline PollyIRBuilder createPollyIRBuilder(llvm::BasicBlock *BB,