File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
mlir/lib/Conversion/SolToStandard Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1894,6 +1894,25 @@ struct DataLocCastOpLowering : public OpConversionPattern<sol::DataLocCastOp> {
18941894 }
18951895 }
18961896
1897+ // From calldata to memory.
1898+ if (srcDataLoc == sol::DataLocation::CallData &&
1899+ dstDataLoc == sol::DataLocation::Memory) {
1900+ // String/bytes type.
1901+ if (isa<sol::StringType>(srcTy)) {
1902+ Value sizeInBytes = evmB.genDynSize (adaptor.getInp (), srcTy);
1903+ Value memAddr = evmB.genMemAllocForDynArray (
1904+ sizeInBytes, bExt.genRoundUpToMultiple <32 >(sizeInBytes));
1905+ Value srcDataAddr = evmB.genDataAddrPtr (adaptor.getInp (), srcTy);
1906+ Value dstDataAddr =
1907+ r.create <arith::AddIOp>(loc, memAddr, bExt.genI256Const (32 ));
1908+
1909+ r.create <yul::CallDataCopyOp>(loc, dstDataAddr, srcDataAddr,
1910+ sizeInBytes);
1911+ r.replaceOp (op, memAddr);
1912+ return success ();
1913+ }
1914+ }
1915+
18971916 llvm_unreachable (" NYI" );
18981917 return failure ();
18991918 }
You can’t perform that action at this time.
0 commit comments