@@ -716,7 +716,7 @@ static void destructureIndices(Type currType, ArrayRef<GEPArg> indices,
716716 dynamicIndices.push_back (val);
717717 }
718718 } else {
719- rawConstantIndices.push_back (iter. get <GEPConstantIndex>());
719+ rawConstantIndices.push_back (cast <GEPConstantIndex>(iter ));
720720 }
721721
722722 // Skip for very first iteration of this loop. First index does not index
@@ -805,7 +805,7 @@ static void printGEPIndices(OpAsmPrinter &printer, LLVM::GEPOp gepOp,
805805 if (Value val = llvm::dyn_cast_if_present<Value>(cst))
806806 printer.printOperand (val);
807807 else
808- printer << cst. get <IntegerAttr>().getInt ();
808+ printer << cast <IntegerAttr>(cst ).getInt ();
809809 });
810810}
811811
@@ -821,11 +821,12 @@ verifyStructIndices(Type baseGEPType, unsigned indexPos,
821821
822822 return TypeSwitch<Type, LogicalResult>(baseGEPType)
823823 .Case <LLVMStructType>([&](LLVMStructType structType) -> LogicalResult {
824- if (!indices[indexPos].is <IntegerAttr>())
824+ auto attr = dyn_cast<IntegerAttr>(indices[indexPos]);
825+ if (!attr)
825826 return emitOpError () << " expected index " << indexPos
826827 << " indexing a struct to be constant" ;
827828
828- int32_t gepIndex = indices[indexPos]. get <IntegerAttr>() .getInt ();
829+ int32_t gepIndex = attr .getInt ();
829830 ArrayRef<Type> elementTypes = structType.getBody ();
830831 if (gepIndex < 0 ||
831832 static_cast <size_t >(gepIndex) >= elementTypes.size ())
@@ -1100,11 +1101,11 @@ CallInterfaceCallable CallOp::getCallableForCallee() {
11001101void CallOp::setCalleeFromCallable (CallInterfaceCallable callee) {
11011102 // Direct call.
11021103 if (FlatSymbolRefAttr calleeAttr = getCalleeAttr ()) {
1103- auto symRef = callee. get <SymbolRefAttr>();
1104+ auto symRef = cast <SymbolRefAttr>(callee );
11041105 return setCalleeAttr (cast<FlatSymbolRefAttr>(symRef));
11051106 }
11061107 // Indirect call, callee Value is the first operand.
1107- return setOperand (0 , callee. get <Value>());
1108+ return setOperand (0 , cast <Value>(callee ));
11081109}
11091110
11101111Operation::operand_range CallOp::getArgOperands () {
@@ -1564,11 +1565,11 @@ CallInterfaceCallable InvokeOp::getCallableForCallee() {
15641565void InvokeOp::setCalleeFromCallable (CallInterfaceCallable callee) {
15651566 // Direct call.
15661567 if (FlatSymbolRefAttr calleeAttr = getCalleeAttr ()) {
1567- auto symRef = callee. get <SymbolRefAttr>();
1568+ auto symRef = cast <SymbolRefAttr>(callee );
15681569 return setCalleeAttr (cast<FlatSymbolRefAttr>(symRef));
15691570 }
15701571 // Indirect call, callee Value is the first operand.
1571- return setOperand (0 , callee. get <Value>());
1572+ return setOperand (0 , cast <Value>(callee ));
15721573}
15731574
15741575Operation::operand_range InvokeOp::getArgOperands () {
@@ -3259,7 +3260,7 @@ OpFoldResult LLVM::GEPOp::fold(FoldAdaptor adaptor) {
32593260 if (Value val = llvm::dyn_cast_if_present<Value>(existing))
32603261 gepArgs.emplace_back (val);
32613262 else
3262- gepArgs.emplace_back (existing. get <IntegerAttr>().getInt ());
3263+ gepArgs.emplace_back (cast <IntegerAttr>(existing ).getInt ());
32633264
32643265 continue ;
32653266 }
0 commit comments