Skip to content

Commit 8cf46f9

Browse files
Artem Gindinsonigcbot
authored andcommitted
[RFC] Drop legacy wrappers for llvm::IRBuilder (pt. 1)
Clean out a bunch of `IRBuilder` wrappers - either made obsolete by a complete switch to LLVM 14 or unwarranted in the first place. There's more wrapper APIs to remove in a separate step during alignment-related cleanup.
1 parent 8e2798f commit 8cf46f9

File tree

6 files changed

+56
-140
lines changed

6 files changed

+56
-140
lines changed

IGC/AdaptorCommon/FreezeIntDiv.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ SPDX-License-Identifier: MIT
1212
#include "common/LLVMWarningsPush.hpp"
1313
#include "llvm/IR/InstVisitor.h"
1414
#include "llvm/IR/IRBuilder.h"
15-
#include "llvmWrapper/IR/IRBuilder.h"
1615
#include "common/LLVMWarningsPop.hpp"
1716

1817
using namespace llvm;
@@ -70,8 +69,8 @@ bool FreezeIntDiv::runOnFunction(Function& F)
7069

7170
void FreezeIntDiv::freezeIntDiv(BinaryOperator& I)
7271
{
73-
IGCLLVM::IRBuilder<> builder(I.getNextNode());
74-
Value* FI = builder.CreateFreezeIfSupported(&I, "freeze");
72+
llvm::IRBuilder<> builder(I.getNextNode());
73+
Value* FI = builder.CreateFreeze(&I, "freeze");
7574
I.replaceAllUsesWith(FI);
7675
cast<Instruction>(FI)->setOperand(0, &I);
7776
}

IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,8 +703,8 @@ bool InstExpander::visitFreeze(FreezeInst& FI) {
703703

704704
auto [Lo, Hi] = Emu->getExpandedValues(Src);
705705

706-
Value* newLo = IRB->CreateFreezeIfSupported(Lo);
707-
Value* newHi = IRB->CreateFreezeIfSupported(Hi);
706+
Value* newLo = IRB->CreateFreeze(Lo);
707+
Value* newHi = IRB->CreateFreeze(Hi);
708708

709709
Emu->setExpandedValues(&FI, newLo, newHi);
710710
return true;

IGC/LLVM3DBuilder/BuiltinsFrontend.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ class SampleD_DC_FromCubeParams
163163

164164

165165
template<bool preserveNames = true, typename T = llvm::ConstantFolder,
166-
typename InserterTyDef() = llvm::IRBuilderDefaultInserter>
167-
class LLVM3DBuilder : public llvm::IGCIRBuilder<T, InserterTyDef()>
166+
typename InserterTy = llvm::IRBuilderDefaultInserter>
167+
class LLVM3DBuilder : public llvm::IGCIRBuilder<T, InserterTy>
168168
{
169169
public:
170170
LLVM3DBuilder(llvm::LLVMContext &pCtx, const PLATFORM &pPlatform)
171-
: llvm::IGCIRBuilder<T, InserterTyDef()>(pCtx),
171+
: llvm::IGCIRBuilder<T, InserterTy>(pCtx),
172172
m_Platform(new genplatform(&pPlatform))
173173
{
174174
Init();

IGC/VectorCompiler/CMCL/lib/Support/BuiltinTranslator.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ SPDX-License-Identifier: MIT
2121
#include <llvm/IR/IRBuilder.h>
2222
#include <llvm/IR/Instructions.h>
2323
#include <llvm/IR/Module.h>
24+
#include <llvm/Support/Alignment.h>
2425
#include <llvm/Support/Casting.h>
2526
#include <llvm/Support/ErrorHandling.h>
2627

2728
#include "llvmWrapper/IR/DerivedTypes.h"
2829
#include "llvmWrapper/IR/IRBuilder.h"
2930
#include "llvmWrapper/IR/Type.h"
30-
#include "llvmWrapper/Support/Alignment.h"
3131

3232
#include <algorithm>
3333
#include <array>
@@ -737,9 +737,8 @@ createMainInst<BuiltinID::AtomicRMW>(const std::vector<Value *> &Operands,
737737
auto BinOp = getLLVMAtomicBinOpFromCMCL(static_cast<CMCLOperation>(
738738
cast<ConstantInt>(Operands[AtomicRMWOperand::Operation])
739739
->getSExtValue()));
740-
return *IGCLLVM::createAtomicRMW(
741-
IRB, BinOp, Ptr, Operands[AtomicRMWOperand::Operand], Ordering,
742-
Ctx.getOrInsertSyncScopeID(ScopeName));
740+
return *IRB.CreateAtomicRMW(BinOp, Ptr, Operands[AtomicRMWOperand::Operand],
741+
llvm::MaybeAlign{}, Ordering, Ctx.getOrInsertSyncScopeID(ScopeName));
743742
}
744743

745744
template <>
@@ -761,10 +760,10 @@ Value &createMainInst<BuiltinID::CmpXchg>(const std::vector<Value *> &Operands,
761760
auto ScopeName = cmcl::atomic::MemoryScope::getScopeNameFromCMCL(
762761
static_cast<CMCLMemoryScope>(
763762
cast<ConstantInt>(Operands[CmpXchgOperand::Scope])->getZExtValue()));
764-
auto *CmpXchgInst = IGCLLVM::createAtomicCmpXchg(
765-
IRB, Ptr, Operands[CmpXchgOperand::Operand0],
766-
Operands[CmpXchgOperand::Operand1], OrderingSuccess, OrderingFalilure,
767-
Ctx.getOrInsertSyncScopeID(ScopeName));
763+
auto *CmpXchgInst = IRB.CreateAtomicCmpXchg(
764+
Ptr, Operands[CmpXchgOperand::Operand0],
765+
Operands[CmpXchgOperand::Operand1], llvm::MaybeAlign{}, OrderingSuccess,
766+
OrderingFalilure, Ctx.getOrInsertSyncScopeID(ScopeName));
768767
return *IRB.CreateExtractValue(CmpXchgInst, 0 /*CmpXchg result*/,
769768
".cmpxchg.res");
770769
}

0 commit comments

Comments
 (0)