Skip to content

Commit 4d405b2

Browse files
committed
implement feedback
1 parent 458c685 commit 4d405b2

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,9 @@ class IRTranslator : public MachineFunctionPass {
297297
/// \pre \p U is a call instruction.
298298
bool translateCall(const User &U, MachineIRBuilder &MIRBuilder);
299299

300-
bool translateTargetIntrinsic(
300+
bool translateIntrinsic(
301301
const CallBase &CB, Intrinsic::ID ID, MachineIRBuilder &MIRBuilder,
302-
TargetLowering::IntrinsicInfo *TgtMemIntrinsicInfo = nullptr);
302+
const TargetLowering::IntrinsicInfo *TgtMemIntrinsicInfo = nullptr);
303303

304304
/// When an invoke or a cleanupret unwinds to the next EH pad, there are
305305
/// many places it could ultimately go. In the IR, we have a single unwind

llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2803,17 +2803,17 @@ bool IRTranslator::translateCall(const User &U, MachineIRBuilder &MIRBuilder) {
28032803
TargetLowering::IntrinsicInfo Info;
28042804
bool IsTgtMemIntrinsic = TLI->getTgtMemIntrinsic(Info, CI, *MF, ID);
28052805

2806-
return translateTargetIntrinsic(CI, ID, MIRBuilder,
2807-
IsTgtMemIntrinsic ? &Info : nullptr);
2806+
return translateIntrinsic(CI, ID, MIRBuilder,
2807+
IsTgtMemIntrinsic ? &Info : nullptr);
28082808
}
28092809

2810-
/// Translate a call to a target intrinsic.
2810+
/// Translate a call to an intrinsic.
28112811
/// Depending on whether TLI->getTgtMemIntrinsic() is true, TgtMemIntrinsicInfo
28122812
/// is a pointer to the correspondingly populated IntrinsicInfo object.
28132813
/// Otherwise, this pointer is null.
2814-
bool IRTranslator::translateTargetIntrinsic(
2814+
bool IRTranslator::translateIntrinsic(
28152815
const CallBase &CB, Intrinsic::ID ID, MachineIRBuilder &MIRBuilder,
2816-
TargetLowering::IntrinsicInfo *TgtMemIntrinsicInfo) {
2816+
const TargetLowering::IntrinsicInfo *TgtMemIntrinsicInfo) {
28172817
ArrayRef<Register> ResultRegs;
28182818
if (!CB.getType()->isVoidTy())
28192819
ResultRegs = getOrCreateVRegs(CB);
@@ -2869,11 +2869,12 @@ bool IRTranslator::translateTargetIntrinsic(
28692869
// TODO: We currently just fallback to address space 0 if getTgtMemIntrinsic
28702870
// didn't yield anything useful.
28712871
MachinePointerInfo MPI;
2872-
if (TgtMemIntrinsicInfo->ptrVal)
2872+
if (TgtMemIntrinsicInfo->ptrVal) {
28732873
MPI = MachinePointerInfo(TgtMemIntrinsicInfo->ptrVal,
28742874
TgtMemIntrinsicInfo->offset);
2875-
else if (TgtMemIntrinsicInfo->fallbackAddressSpace)
2875+
} else if (TgtMemIntrinsicInfo->fallbackAddressSpace) {
28762876
MPI = MachinePointerInfo(*TgtMemIntrinsicInfo->fallbackAddressSpace);
2877+
}
28772878
MIB.addMemOperand(MF->getMachineMemOperand(
28782879
MPI, TgtMemIntrinsicInfo->flags, MemTy, Alignment, CB.getAAMetadata(),
28792880
/*Ranges=*/nullptr, TgtMemIntrinsicInfo->ssid,

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5368,8 +5368,9 @@ SmallVector<SDValue, 8> SelectionDAGBuilder::getTargetIntrinsicOperands(
53685368
}
53695369
}
53705370

5371-
if (auto Bundle = I.getOperandBundle(LLVMContext::OB_convergencectrl)) {
5372-
auto *Token = Bundle->Inputs[0].get();
5371+
if (std::optional<OperandBundleUse> Bundle =
5372+
I.getOperandBundle(LLVMContext::OB_convergencectrl)) {
5373+
Value *Token = Bundle->Inputs[0].get();
53735374
SDValue ConvControlToken = getValue(Token);
53745375
assert(Ops.back().getValueType() != MVT::Glue &&
53755376
"Did not expected another glue node here.");
@@ -5396,9 +5397,10 @@ SDVTList SelectionDAGBuilder::getTargetIntrinsicVTList(const CallBase &I,
53965397

53975398
/// Get an INTRINSIC node for a target intrinsic which does not touch touch
53985399
/// memory.
5399-
SDValue SelectionDAGBuilder::getTargetNonMemIntrinsicNode(
5400-
const CallBase &I, bool HasChain, SmallVector<SDValue, 8> &Ops,
5401-
SDVTList &VTs) {
5400+
SDValue SelectionDAGBuilder::getTargetNonMemIntrinsicNode(const CallBase &I,
5401+
bool HasChain,
5402+
ArrayRef<SDValue> Ops,
5403+
SDVTList &VTs) {
54025404
if (!HasChain)
54035405
return DAG.getNode(ISD::INTRINSIC_WO_CHAIN, getCurSDLoc(), VTs, Ops);
54045406
if (!I.getType()->isVoidTy())

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,7 @@ class SelectionDAGBuilder {
718718
TargetLowering::IntrinsicInfo *TgtMemIntrinsicInfo = nullptr);
719719
SDVTList getTargetIntrinsicVTList(const CallBase &I, bool HasChain);
720720
SDValue getTargetNonMemIntrinsicNode(const CallBase &I, bool HasChain,
721-
SmallVector<SDValue, 8> &Ops,
722-
SDVTList &VTs);
721+
ArrayRef<SDValue> Ops, SDVTList &VTs);
723722
SDValue handleTargetIntrinsicRet(const CallBase &I, bool HasChain,
724723
bool OnlyLoad, SDValue Result);
725724
};

0 commit comments

Comments
 (0)