Skip to content

Commit 9a0cc48

Browse files
committed
Address code review comments
1 parent 990d969 commit 9a0cc48

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

clang/lib/CIR/CodeGen/CIRGenExpr.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -627,18 +627,16 @@ RValue CIRGenFunction::emitLoadOfLValue(LValue lv, SourceLocation loc) {
627627
lv.getVectorIdx()));
628628
}
629629

630-
if (lv.isExtVectorElt()) {
630+
if (lv.isExtVectorElt())
631631
return emitLoadOfExtVectorElementLValue(lv);
632-
}
633632

634633
cgm.errorNYI(loc, "emitLoadOfLValue");
635634
return RValue::get(nullptr);
636635
}
637636

638637
int64_t CIRGenFunction::getAccessedFieldNo(unsigned int idx,
639638
const mlir::ArrayAttr elts) {
640-
auto elt = mlir::dyn_cast<mlir::IntegerAttr>(elts[idx]);
641-
assert(elt && "The indices should be integer attributes");
639+
auto elt = mlir::cast<mlir::IntegerAttr>(elts[idx]);
642640
return elt.getInt();
643641
}
644642

@@ -1186,11 +1184,7 @@ LValue CIRGenFunction::emitExtVectorElementExpr(const ExtVectorElementExpr *e) {
11861184
e->getEncodedElementAccess(indices);
11871185

11881186
if (base.isSimple()) {
1189-
SmallVector<int64_t> attrElts;
1190-
for (uint32_t i : indices) {
1191-
attrElts.push_back(static_cast<int64_t>(i));
1192-
}
1193-
1187+
SmallVector<int64_t> attrElts(indices.begin(), indices.end());
11941188
mlir::ArrayAttr elts = builder.getI64ArrayAttr(attrElts);
11951189
return LValue::makeExtVectorElt(base.getAddress(), elts, type,
11961190
base.getBaseInfo());

0 commit comments

Comments
 (0)