Skip to content

Commit dcf264d

Browse files
jayfoadyuxuanchen1997
authored andcommitted
[AMDGPU] clang-tidy: use std::make_unique. NFC.
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60250939
1 parent 21344b5 commit dcf264d

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,13 +344,13 @@ bool AMDGPUAsmPrinter::doInitialization(Module &M) {
344344
if (TM.getTargetTriple().getOS() == Triple::AMDHSA) {
345345
switch (CodeObjectVersion) {
346346
case AMDGPU::AMDHSA_COV4:
347-
HSAMetadataStream.reset(new HSAMD::MetadataStreamerMsgPackV4());
347+
HSAMetadataStream = std::make_unique<HSAMD::MetadataStreamerMsgPackV4>();
348348
break;
349349
case AMDGPU::AMDHSA_COV5:
350-
HSAMetadataStream.reset(new HSAMD::MetadataStreamerMsgPackV5());
350+
HSAMetadataStream = std::make_unique<HSAMD::MetadataStreamerMsgPackV5>();
351351
break;
352352
case AMDGPU::AMDHSA_COV6:
353-
HSAMetadataStream.reset(new HSAMD::MetadataStreamerMsgPackV6());
353+
HSAMetadataStream = std::make_unique<HSAMD::MetadataStreamerMsgPackV6>();
354354
break;
355355
default:
356356
report_fatal_error("Unexpected code object version");

llvm/lib/Target/AMDGPU/AMDGPULibFunc.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,9 +1084,9 @@ bool UnmangledFuncInfo::lookup(StringRef Name, ID &Id) {
10841084

10851085
AMDGPULibFunc::AMDGPULibFunc(const AMDGPULibFunc &F) {
10861086
if (auto *MF = dyn_cast<AMDGPUMangledLibFunc>(F.Impl.get()))
1087-
Impl.reset(new AMDGPUMangledLibFunc(*MF));
1087+
Impl = std::make_unique<AMDGPUMangledLibFunc>(*MF);
10881088
else if (auto *UMF = dyn_cast<AMDGPUUnmangledLibFunc>(F.Impl.get()))
1089-
Impl.reset(new AMDGPUUnmangledLibFunc(*UMF));
1089+
Impl = std::make_unique<AMDGPUUnmangledLibFunc>(*UMF);
10901090
else
10911091
Impl = std::unique_ptr<AMDGPULibFuncImpl>();
10921092
}
@@ -1101,19 +1101,21 @@ AMDGPULibFunc &AMDGPULibFunc::operator=(const AMDGPULibFunc &F) {
11011101
AMDGPULibFunc::AMDGPULibFunc(EFuncId Id, const AMDGPULibFunc &CopyFrom) {
11021102
assert(AMDGPULibFuncBase::isMangled(Id) && CopyFrom.isMangled() &&
11031103
"not supported");
1104-
Impl.reset(new AMDGPUMangledLibFunc(
1105-
Id, *cast<AMDGPUMangledLibFunc>(CopyFrom.Impl.get())));
1104+
Impl = std::make_unique<AMDGPUMangledLibFunc>(
1105+
Id, *cast<AMDGPUMangledLibFunc>(CopyFrom.Impl.get()));
11061106
}
11071107

11081108
AMDGPULibFunc::AMDGPULibFunc(EFuncId Id, FunctionType *FT, bool SignedInts) {
1109-
Impl.reset(new AMDGPUMangledLibFunc(Id, FT, SignedInts));
1109+
Impl = std::make_unique<AMDGPUMangledLibFunc>(Id, FT, SignedInts);
11101110
}
11111111

11121112
AMDGPULibFunc::AMDGPULibFunc(StringRef Name, FunctionType *FT) {
1113-
Impl.reset(new AMDGPUUnmangledLibFunc(Name, FT));
1113+
Impl = std::make_unique<AMDGPUUnmangledLibFunc>(Name, FT);
11141114
}
11151115

1116-
void AMDGPULibFunc::initMangled() { Impl.reset(new AMDGPUMangledLibFunc()); }
1116+
void AMDGPULibFunc::initMangled() {
1117+
Impl = std::make_unique<AMDGPUMangledLibFunc>();
1118+
}
11171119

11181120
AMDGPULibFunc::Param *AMDGPULibFunc::getLeads() {
11191121
if (!Impl)

llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,13 @@ GCNSubtarget::GCNSubtarget(const Triple &TT, StringRef GPU, StringRef FS,
203203
// clang-format on
204204
MaxWavesPerEU = AMDGPU::IsaInfo::getMaxWavesPerEU(this);
205205
EUsPerCU = AMDGPU::IsaInfo::getEUsPerCU(this);
206-
CallLoweringInfo.reset(new AMDGPUCallLowering(*getTargetLowering()));
207-
InlineAsmLoweringInfo.reset(new InlineAsmLowering(getTargetLowering()));
208-
Legalizer.reset(new AMDGPULegalizerInfo(*this, TM));
209-
RegBankInfo.reset(new AMDGPURegisterBankInfo(*this));
210-
InstSelector.reset(new AMDGPUInstructionSelector(*this, *RegBankInfo, TM));
206+
CallLoweringInfo = std::make_unique<AMDGPUCallLowering>(*getTargetLowering());
207+
InlineAsmLoweringInfo =
208+
std::make_unique<InlineAsmLowering>(getTargetLowering());
209+
Legalizer = std::make_unique<AMDGPULegalizerInfo>(*this, TM);
210+
RegBankInfo = std::make_unique<AMDGPURegisterBankInfo>(*this);
211+
InstSelector =
212+
std::make_unique<AMDGPUInstructionSelector>(*this, *RegBankInfo, TM);
211213
}
212214

213215
unsigned GCNSubtarget::getConstantBusLimit(unsigned Opcode) const {

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ void SIInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
10891089
// whole block for every handled copy.
10901090
std::unique_ptr<RegScavenger> RS;
10911091
if (Opcode == AMDGPU::INSTRUCTION_LIST_END)
1092-
RS.reset(new RegScavenger());
1092+
RS = std::make_unique<RegScavenger>();
10931093

10941094
ArrayRef<int16_t> SubIndices = RI.getRegSplitParts(RC, EltSize);
10951095

0 commit comments

Comments
 (0)