diff --git a/llvm/lib/Target/EVM/EVMOptimizedCodeTransform.cpp b/llvm/lib/Target/EVM/EVMOptimizedCodeTransform.cpp index d84994551bcb..1101076616f1 100644 --- a/llvm/lib/Target/EVM/EVMOptimizedCodeTransform.cpp +++ b/llvm/lib/Target/EVM/EVMOptimizedCodeTransform.cpp @@ -168,13 +168,13 @@ void EVMOptimizedCodeTransform::createStackLayout(Stack TargetStack) { std::string VarNameDeep = SlotVariableName(DeepSlot); std::string VarNameTop = SlotVariableName(CurrentStack.back()); std::string Msg = - (Twine("Cannot swap ") + - (VarNameDeep.empty() ? ("Slot " + stackSlotToString(DeepSlot)) - : (Twine("Variable ") + VarNameDeep)) + + (Twine("cannot swap ") + + (VarNameDeep.empty() ? ("slot " + stackSlotToString(DeepSlot)) + : (Twine("variable ") + VarNameDeep)) + " with " + (VarNameTop.empty() - ? ("Slot " + stackSlotToString(CurrentStack.back())) - : (Twine("Variable ") + VarNameTop)) + + ? ("slot " + stackSlotToString(CurrentStack.back())) + : (Twine("variable ") + VarNameTop)) + ": too deep in the stack by " + std::to_string(Deficit) + " slots in " + stackToString(CurrentStack)) .str(); @@ -194,9 +194,9 @@ void EVMOptimizedCodeTransform::createStackLayout(Stack TargetStack) { return; } else if (!canBeFreelyGenerated(Slot)) { std::string VarName = SlotVariableName(Slot); - Twine Msg = - ((VarName.empty() ? "Slot " + stackSlotToString(Slot) - : Twine("Variable ") + VarName) + + std::string Msg = + ((VarName.empty() ? "slot " + stackSlotToString(Slot) + : Twine("variable ") + VarName) + " is " + std::to_string(*Depth - 15) + " too deep in the stack " + stackToString(CurrentStack)) .str(); diff --git a/llvm/lib/Target/EVM/EVMStackLayoutGenerator.cpp b/llvm/lib/Target/EVM/EVMStackLayoutGenerator.cpp index 7af6d62b595f..c67b76c297e7 100644 --- a/llvm/lib/Target/EVM/EVMStackLayoutGenerator.cpp +++ b/llvm/lib/Target/EVM/EVMStackLayoutGenerator.cpp @@ -272,7 +272,7 @@ Stack StackLayoutGenerator::propagateStackThroughOperation( if (auto const *VarSlot = std::get_if(&StackSlot)) assert(!EVMUtils::contains(Assignment->Variables, *VarSlot)); - // Since stack+Operation.output can be easily shuffled to _exitLayout, the + // Since stack+Operation.output can be easily shuffled to ExitLayout, the // desired layout before the operation is stack+Operation.input; IdealStack += Operation.Input; diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 2da55f1d474d..83b09427f5d7 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -166,8 +166,13 @@ Instruction *InstCombinerImpl::SimplifyAnyMemTransfer(AnyMemTransferInst *MI) { assert(Size && "0-sized memory transferring should be removed already."); // EraVM local begin - uint64_t SizeLimit = 8; + // For EVM we do not need to expand memcpy at all, as the possible memcpy + // operations are 1 to 1 mapped to corresponding instructions. Triple TT(MI->getFunction()->getParent()->getTargetTriple()); + if (TT.isEVM()) + return nullptr; + + uint64_t SizeLimit = 8; if (TT.isEraVM()) SizeLimit = 32;