Skip to content

Commit 6c047a5

Browse files
tommymcmxlauko
andauthored
[CIR] Added namespace qualifiers
Co-authored-by: Henrich Lauko <xlauko@mail.muni.cz>
1 parent 21c1506 commit 6c047a5

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

clang/lib/CIR/CodeGen/CIRGenBuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ mlir::Value CIRGenBuilderTy::getArrayElement(const clang::TargetInfo &ti,
5757
mlir::Value arrayPtr,
5858
mlir::Type eltTy, mlir::Value idx,
5959
bool shouldDecay) {
60-
auto arrayPtrTy = dyn_cast<cir::PointerType>(arrayPtr.getType());
60+
auto arrayPtrTy = mlir::dyn_cast<cir::PointerType>(arrayPtr.getType());
6161
assert(arrayPtrTy && "expected pointer type");
6262

6363
// If the array pointer is not decayed, emit a GetElementOp.
64-
auto arrayTy = dyn_cast<cir::ArrayType>(arrayPtrTy.getPointee());
64+
auto arrayTy = mlir::dyn_cast<cir::ArrayType>(arrayPtrTy.getPointee());
6565
if (shouldDecay && arrayTy && arrayTy == eltTy) {
6666
auto eltPtrTy =
6767
getPointerTo(arrayTy.getElementType(), arrayPtrTy.getAddrSpace());

clang/lib/CIR/Dialect/IR/CIRDialect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3842,7 +3842,7 @@ LogicalResult cir::GetMethodOp::verify() {
38423842
//===----------------------------------------------------------------------===//
38433843

38443844
LogicalResult cir::GetElementOp::verify() {
3845-
auto arrayTy = cast<ArrayType>(getBaseType().getPointee());
3845+
auto arrayTy = mlir::cast<cir::ArrayType>(getBaseType().getPointee());
38463846
if (getElementType() != arrayTy.getElementType())
38473847
return emitError() << "element type mismatch";
38483848

clang/lib/CIR/Dialect/Transforms/LifetimeCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,7 @@ void LifetimeCheckPass::updatePointsTo(mlir::Value addr, mlir::Value data,
12541254
return;
12551255
}
12561256

1257-
if (auto getElemOp = dyn_cast<GetElementOp>(dataSrcOp)) {
1257+
if (auto getElemOp = mlir::dyn_cast<cir::GetElementOp>(dataSrcOp)) {
12581258
getPmap()[addr].clear();
12591259
getPmap()[addr].insert(State::getLocalValue(getElemOp.getBase()));
12601260
return;

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -958,19 +958,19 @@ static mlir::Value promoteIndex(mlir::ConversionPatternRewriter &rewriter,
958958
if (!indexOp)
959959
return index;
960960

961-
auto indexType = cast<mlir::IntegerType>(index.getType());
961+
auto indexType = mlir::cast<mlir::IntegerType>(index.getType());
962962
auto width = indexType.getWidth();
963963
if (layoutWidth == width)
964964
return index;
965965

966966
// If the index definition is a unary minus (index = sub 0, x), then we need
967967
// to
968968
bool rewriteSub = false;
969-
auto sub = dyn_cast<mlir::LLVM::SubOp>(indexOp);
969+
auto sub = mlir::dyn_cast<mlir::LLVM::SubOp>(indexOp);
970970
if (sub) {
971971
if (auto lhsConst = dyn_cast<mlir::LLVM::ConstantOp>(
972972
sub.getOperand(0).getDefiningOp())) {
973-
auto lhsConstInt = dyn_cast<mlir::IntegerAttr>(lhsConst.getValue());
973+
auto lhsConstInt = mlir::dyn_cast<mlir::IntegerAttr>(lhsConst.getValue());
974974
if (lhsConstInt && lhsConstInt.getValue() == 0) {
975975
rewriteSub = true;
976976
index = sub.getOperand(1);
@@ -1018,7 +1018,7 @@ mlir::LogicalResult CIRToLLVMPtrStrideOpLowering::matchAndRewrite(
10181018
LLVMLayout.getTypeIndexBitwidth(adaptor.getBase().getType())) {
10191019
bool isUnsigned = false;
10201020
if (auto strideTy =
1021-
dyn_cast<cir::IntType>(ptrStrideOp.getOperand(1).getType()))
1021+
mlir::dyn_cast<cir::IntType>(ptrStrideOp.getOperand(1).getType()))
10221022
isUnsigned = strideTy.isUnsigned();
10231023
index = promoteIndex(rewriter, index, *layoutWidth, isUnsigned);
10241024
}

0 commit comments

Comments
 (0)