Skip to content

Commit 22cdc6a

Browse files
[llvm] Use llvm::bit_ceil instead of PowerOf2Ceil (NFC)
The arguments to PowerOf2Ceil in this patch are all known to be nonzero, so we can safely use llvm::bit_ceil here.
1 parent fd64482 commit 22cdc6a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ static SDValue combineShiftToAVG(SDValue Op, SelectionDAG &DAG,
10401040
EVT VT = Op.getValueType();
10411041
unsigned MinWidth =
10421042
std::max<unsigned>(VT.getScalarSizeInBits() - KnownBits, 8);
1043-
EVT NVT = EVT::getIntegerVT(*DAG.getContext(), PowerOf2Ceil(MinWidth));
1043+
EVT NVT = EVT::getIntegerVT(*DAG.getContext(), llvm::bit_ceil(MinWidth));
10441044
if (VT.isVector())
10451045
NVT = EVT::getVectorVT(*DAG.getContext(), NVT, VT.getVectorElementCount());
10461046
if (!TLI.isOperationLegalOrCustom(AVGOpc, NVT))

llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2137,7 +2137,7 @@ static int sizeToSubRegIndex(unsigned Size) {
21372137
return AMDGPU::sub0;
21382138
if (Size > 256)
21392139
return -1;
2140-
return sizeToSubRegIndex(PowerOf2Ceil(Size));
2140+
return sizeToSubRegIndex(llvm::bit_ceil(Size));
21412141
}
21422142
}
21432143

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37707,7 +37707,7 @@ X86TargetLowering::targetShrinkDemandedConstant(SDValue Op,
3770737707
return false;
3770837708

3770937709
// Find the next power of 2 width, rounding up to a byte.
37710-
Width = PowerOf2Ceil(std::max(Width, 8U));
37710+
Width = llvm::bit_ceil(std::max(Width, 8U));
3771137711
// Truncate the width to size to handle illegal types.
3771237712
Width = std::min(Width, EltSize);
3771337713

0 commit comments

Comments
 (0)