[llvm-commits] [llvm] r47965 - /llvm/trunk/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
Devang Patel
dpatel at apple.com
Fri Mar 7 17:30:59 PST 2008
On Mar 7, 2008, at 5:27 PM, Chris Lattner wrote:
>> + else if (const StructType *STy =
>> dyn_cast<StructType>(F.getReturnType())) {
>> + for (unsigned i = 0; i < NumRetVals; ++i) {
>> + PHINode *PN = new PHINode(STy->getElementType(i),
>> "UnifiedRetVal");
>> + NewRetBlock->getInstList().push_back(PN);
>> + Phis.push_back(PN);
>> + }
>> + new ReturnInst(&Phis[0], NumRetVals);
>
> This loop is not specific to multiple return case. It would work just
> as well for the single return case. Please remove the check for
> StructType.
>
> Also, you can specify the insertion point directly in the phi node, to
> avoid the getInstList().push_back. As with the inliner, you should
> use more specific names "UnifiedRetVal.42" if possible, and insert in
> forward order instead of backwards.
OK
-
Devang
More information about the llvm-commits
mailing list