Skip to content

Commit

Permalink
Use APInt::getOneBitSet (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata committed Apr 11, 2023
1 parent 53aa22c commit 63c4967
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions clang/lib/CodeGen/CGExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,8 +829,8 @@ static llvm::Value *EmitCXXNewAllocSize(CodeGenFunction &CGF,
// going to have to do a comparison for (2), and this happens to
// take care of (1), too.
if (numElementsWidth > sizeWidth) {
llvm::APInt threshold(numElementsWidth, 1);
threshold <<= sizeWidth;
llvm::APInt threshold =
llvm::APInt::getOneBitSet(numElementsWidth, sizeWidth);

llvm::Value *thresholdV
= llvm::ConstantInt::get(numElementsType, threshold);
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8811,8 +8811,7 @@ SDValue TargetLowering::expandBITREVERSE(SDNode *N, SelectionDAG &DAG) const {
Tmp2 =
DAG.getNode(ISD::SRL, dl, VT, Op, DAG.getConstant(I - J, dl, SHVT));

APInt Shift(Sz, 1);
Shift <<= J;
APInt Shift = APInt::getOneBitSet(Sz, J);
Tmp2 = DAG.getNode(ISD::AND, dl, VT, Tmp2, DAG.getConstant(Shift, dl, VT));
Tmp = DAG.getNode(ISD::OR, dl, VT, Tmp, Tmp2);
}
Expand Down

0 comments on commit 63c4967

Please sign in to comment.