Skip to content

Commit 6a6fe25

Browse files
committed
Review comments
1 parent 37dcbcc commit 6a6fe25

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,8 +1192,7 @@ bool AMDGPURegisterBankInfo::applyMappingDynStackAlloc(
11921192

11931193
if (SizeBank != &AMDGPU::SGPRRegBank) {
11941194
auto WaveReduction =
1195-
B.buildIntrinsic(Intrinsic::amdgcn_wave_reduce_umax,
1196-
{LLT::scalar(MRI.getType(AllocSize).getSizeInBits())})
1195+
B.buildIntrinsic(Intrinsic::amdgcn_wave_reduce_umax, {LLT::scalar(32)})
11971196
.addUse(AllocSize)
11981197
.addImm(0);
11991198
AllocSize = WaveReduction.getReg(0);

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4018,10 +4018,10 @@ SDValue SITargetLowering::LowerCall(CallLoweringInfo &CLI,
40184018

40194019
// This is similar to the default implementation in ExpandDYNAMIC_STACKALLOC,
40204020
// except for:
4021-
// 1. stack growth direction(default: downwards, AMDGPU: upwards), and
4022-
// 2. scale size where, scale = wave-reduction(alloca-size) * wave-size
4023-
SDValue SITargetLowering::lowerDYNAMIC_STACKALLOCImpl(SDValue Op,
4024-
SelectionDAG &DAG) const {
4021+
// 1. Stack growth direction(default: downwards, AMDGPU: upwards), and
4022+
// 2. Scale size where, scale = wave-reduction(alloca-size) * wave-size
4023+
SDValue SITargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
4024+
SelectionDAG &DAG) const {
40254025
const MachineFunction &MF = DAG.getMachineFunction();
40264026
const SIMachineFunctionInfo *Info = MF.getInfo<SIMachineFunctionInfo>();
40274027

@@ -4057,13 +4057,13 @@ SDValue SITargetLowering::lowerDYNAMIC_STACKALLOCImpl(SDValue Op,
40574057
assert(Size.getValueType() == MVT::i32 && "Size must be 32-bit");
40584058
SDValue NewSP;
40594059
if (isa<ConstantSDNode>(Op.getOperand(1))) {
4060-
// for constant sized alloca, scale alloca size by wave-size
4060+
// For constant sized alloca, scale alloca size by wave-size
40614061
SDValue ScaledSize = DAG.getNode(
40624062
ISD::SHL, dl, VT, Size,
40634063
DAG.getConstant(Subtarget->getWavefrontSizeLog2(), dl, MVT::i32));
40644064
NewSP = DAG.getNode(ISD::ADD, dl, VT, BaseAddr, ScaledSize); // Value
40654065
} else {
4066-
// for dynamic sized alloca, perform wave-wide reduction to get max of
4066+
// For dynamic sized alloca, perform wave-wide reduction to get max of
40674067
// alloca size(divergent) and then scale it by wave-size
40684068
SDValue WaveReduction =
40694069
DAG.getTargetConstant(Intrinsic::amdgcn_wave_reduce_umax, dl, MVT::i32);
@@ -4086,11 +4086,6 @@ SDValue SITargetLowering::lowerDYNAMIC_STACKALLOCImpl(SDValue Op,
40864086
return DAG.getMergeValues({BaseAddr, CallSeqEnd}, dl);
40874087
}
40884088

4089-
SDValue SITargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
4090-
SelectionDAG &DAG) const {
4091-
return lowerDYNAMIC_STACKALLOCImpl(Op, DAG); // Use "generic" expansion.
4092-
}
4093-
40944089
SDValue SITargetLowering::LowerSTACKSAVE(SDValue Op, SelectionDAG &DAG) const {
40954090
if (Op.getValueType() != MVT::i32)
40964091
return Op; // Defer to cannot select error.

llvm/lib/Target/AMDGPU/SIISelLowering.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,6 @@ class SITargetLowering final : public AMDGPUTargetLowering {
421421
SDValue LowerCall(CallLoweringInfo &CLI,
422422
SmallVectorImpl<SDValue> &InVals) const override;
423423

424-
SDValue lowerDYNAMIC_STACKALLOCImpl(SDValue Op, SelectionDAG &DAG) const;
425424
SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const;
426425
SDValue LowerSTACKSAVE(SDValue Op, SelectionDAG &DAG) const;
427426
SDValue lowerGET_ROUNDING(SDValue Op, SelectionDAG &DAG) const;

0 commit comments

Comments
 (0)