[llvm] [llvm] Add comment and assert for CloneModule edge case (PR #67734)
Yaxun Liu via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 29 07:13:37 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.\
----------------
yxsamliu wrote:
what if the function is really empty?
How about use OldFunc->assertModuleIsMaterialized() instead?
https://github.com/llvm/llvm-project/pull/67734
More information about the llvm-commits
mailing list