Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: llvm/llvm-project
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: SLTozer/llvm-project
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: add-instruction-insert-position
Choose a head ref
  • 5 commits
  • 12 files changed
  • 1 contributor

Commits on Jun 19, 2024

  1. Use InsertPosition for insertion in all Instructions and IRBuilder

    SLTozer committed Jun 19, 2024
    Copy the full SHA
    da18a11 View commit details
  2. Change IsValid->isValid, address review comments

    SLTozer committed Jun 19, 2024
    Copy the full SHA
    c368c26 View commit details
  3. Fix IRBuilderHelper subclass in Polly

    SLTozer committed Jun 19, 2024
    Copy the full SHA
    9b4b1a3 View commit details
  4. Missed a spot!

    SLTozer committed Jun 19, 2024
    Copy the full SHA
    3d67d92 View commit details
  5. Remove inappropriate defaults

    SLTozer committed Jun 19, 2024
    Copy the full SHA
    f4c6dc9 View commit details
1 change: 0 additions & 1 deletion clang/lib/CodeGen/CGBuilder.h
Original file line number Diff line number Diff line change
@@ -35,7 +35,6 @@ class CGBuilderInserter final : public llvm::IRBuilderDefaultInserter {

/// This forwards to CodeGenFunction::InsertHelper.
void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name,
llvm::BasicBlock *BB,
llvm::BasicBlock::iterator InsertPt) const override;

private:
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGExpr.cpp
Original file line number Diff line number Diff line change
@@ -120,7 +120,7 @@ llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty,
Alloca = Builder.CreateAlloca(Ty, ArraySize, Name);
else
Alloca = new llvm::AllocaInst(Ty, CGM.getDataLayout().getAllocaAddrSpace(),
ArraySize, Name, AllocaInsertPt);
ArraySize, Name, &*AllocaInsertPt);
if (Allocas) {
Allocas->Add(Alloca);
}
7 changes: 3 additions & 4 deletions clang/lib/CodeGen/CodeGenFunction.cpp
Original file line number Diff line number Diff line change
@@ -2637,19 +2637,18 @@ CodeGenFunction::SanitizerScope::~SanitizerScope() {

void CodeGenFunction::InsertHelper(llvm::Instruction *I,
const llvm::Twine &Name,
llvm::BasicBlock *BB,
llvm::BasicBlock::iterator InsertPt) const {
LoopStack.InsertHelper(I);
if (IsSanitizerScope)
I->setNoSanitizeMetadata();
}

void CGBuilderInserter::InsertHelper(
llvm::Instruction *I, const llvm::Twine &Name, llvm::BasicBlock *BB,
llvm::Instruction *I, const llvm::Twine &Name,
llvm::BasicBlock::iterator InsertPt) const {
llvm::IRBuilderDefaultInserter::InsertHelper(I, Name, BB, InsertPt);
llvm::IRBuilderDefaultInserter::InsertHelper(I, Name, InsertPt);
if (CGF)
CGF->InsertHelper(I, Name, BB, InsertPt);
CGF->InsertHelper(I, Name, InsertPt);
}

// Emits an error if we don't have a valid set of target features for the
1 change: 0 additions & 1 deletion clang/lib/CodeGen/CodeGenFunction.h
Original file line number Diff line number Diff line change
@@ -343,7 +343,6 @@ class CodeGenFunction : public CodeGenTypeCache {
/// CGBuilder insert helper. This function is called after an
/// instruction is created using Builder.
void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name,
llvm::BasicBlock *BB,
llvm::BasicBlock::iterator InsertPt) const;

/// CurFuncDecl - Holds the Decl for the current outermost
10 changes: 4 additions & 6 deletions llvm/include/llvm/IR/IRBuilder.h
Original file line number Diff line number Diff line change
@@ -63,10 +63,9 @@ class IRBuilderDefaultInserter {
virtual ~IRBuilderDefaultInserter();

virtual void InsertHelper(Instruction *I, const Twine &Name,
BasicBlock *BB,
BasicBlock::iterator InsertPt) const {
if (BB)
I->insertInto(BB, InsertPt);
if (InsertPt.isValid())
I->insertInto(InsertPt.getNodeParent(), InsertPt);
I->setName(Name);
}
};
@@ -83,9 +82,8 @@ class IRBuilderCallbackInserter : public IRBuilderDefaultInserter {
: Callback(std::move(Callback)) {}

void InsertHelper(Instruction *I, const Twine &Name,
BasicBlock *BB,
BasicBlock::iterator InsertPt) const override {
IRBuilderDefaultInserter::InsertHelper(I, Name, BB, InsertPt);
IRBuilderDefaultInserter::InsertHelper(I, Name, InsertPt);
Callback(I);
}
};
@@ -143,7 +141,7 @@ class IRBuilderBase {
/// Insert and return the specified instruction.
template<typename InstTy>
InstTy *Insert(InstTy *I, const Twine &Name = "") const {
Inserter.InsertHelper(I, Name, BB, InsertPt);
Inserter.InsertHelper(I, Name, InsertPt);
AddMetadataToInst(I);
return I;
}
Loading