[PATCH] D35106: [cloning] Do not duplicate types when cloning functions
Gor Nishanov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 9 06:14:16 PDT 2017
GorNishanov added a comment.
In https://reviews.llvm.org/D35106#801808, @loladiro wrote:
> The implementation of this looks good to me. I guess I'm not entirely sure why it's necessary for that type to be distinct in the first place, but that's probably a different discussion from just fixing this bug.
Clang code has a comment that:
// Elements of composite types usually have back to the type, creating
// uniquing cycles. Distinct nodes are more efficient.
================
Comment at: lib/Transforms/Utils/CloneFunction.cpp:49
bool hasCalls = false, hasDynamicAllocas = false, hasStaticAllocas = false;
-
+ Module *TheModule = F ? F->getParent() : nullptr;
+
----------------
loladiro wrote:
> Does this ever get called without a valid `F`?
Yes, In two places.
In llvm/lib/CodeGen/WinEHPrepare.cpp and
in llvm/lib/Transforms/Utils/LoopUnroll.cpp
I am wondering if it is just an oversight due to the F parameter having a default value of nullptr and in those two places function parameter is omitted.
https://reviews.llvm.org/D35106
More information about the llvm-commits
mailing list