[llvm] [llvm] Add comment and assert for CloneModule edge case (PR #67734)
Jacob Lambert via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 16 17:29:40 PDT 2023
================
@@ -268,6 +268,8 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
// Loop over all of the instructions in the new function, fixing up operand
// references as we go. This uses VMap to do all the hard work.
+ assert(!OldFunc->empty() && "Cannot clone module with empty function body.\
----------------
lamb-j wrote:
Good catch. I tested and even empty functions are OK as long as they're materialized. I'll update this check
https://github.com/llvm/llvm-project/pull/67734
More information about the llvm-commits
mailing list