Fwd: [PATCH] SelectionDAGBuilder: move constant initialization out of loop

Mehdi Amini mehdi.amini at apple.com
Sun Jan 4 17:50:29 PST 2015


+llvm-commits

No semantic change intended. Just code motion.

Mehdi





> Begin forwarded message:
> 
> Date: January 4, 2015 at 5:46:27 PM PST
> To: mehdi.amini at apple.com, resistor at mac.com
> From: Mehdi AMINI <mehdi.amini at apple.com>
> Reply-To: reviews+D6834+public+fc980a91a15de874 at reviews.llvm.org
> Subject: Re: [PATCH] SelectionDAGBuilder: move constant initialization out of loop
> 
> Fix stupid typo.
> 
> 
> http://reviews.llvm.org/D6834
> 
> Files:
>  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
> 
> Index: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
> ===================================================================
> --- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
> +++ lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
> @@ -1238,24 +1238,26 @@
>     unsigned NumValues = ValueVTs.size();
>     if (NumValues) {
>       SDValue RetOp = getValue(I.getOperand(0));
> -      for (unsigned j = 0, f = NumValues; j != f; ++j) {
> -        EVT VT = ValueVTs[j];
> 
> -        ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
> +      const Function *F = I.getParent()->getParent();
> +      LLVMContext &Context = F->getContext();
> 
> -        const Function *F = I.getParent()->getParent();
> -        if (F->getAttributes().hasAttribute(AttributeSet::ReturnIndex,
> -                                            Attribute::SExt))
> -          ExtendKind = ISD::SIGN_EXTEND;
> -        else if (F->getAttributes().hasAttribute(AttributeSet::ReturnIndex,
> -                                                 Attribute::ZExt))
> -          ExtendKind = ISD::ZERO_EXTEND;
> +      ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
> +      if (F->getAttributes().hasAttribute(AttributeSet::ReturnIndex,
> +                                          Attribute::SExt))
> +        ExtendKind = ISD::SIGN_EXTEND;
> +      else if (F->getAttributes().hasAttribute(AttributeSet::ReturnIndex,
> +                                               Attribute::ZExt))
> +        ExtendKind = ISD::ZERO_EXTEND;
> +
> +      for (unsigned j = 0; j != NumValues; ++j) {
> +        EVT VT = ValueVTs[j];
> 
>         if (ExtendKind != ISD::ANY_EXTEND && VT.isInteger())
>           VT = TLI.getTypeForExtArgOrReturn(*DAG.getContext(), VT, ExtendKind);
> 
> -        unsigned NumParts = TLI.getNumRegisters(*DAG.getContext(), VT);
> -        MVT PartVT = TLI.getRegisterType(*DAG.getContext(), VT);
> +        unsigned NumParts = TLI.getNumRegisters(Context, VT);
> +        MVT PartVT = TLI.getRegisterType(Context, VT);
>         SmallVector<SDValue, 4> Parts(NumParts);
>         getCopyToParts(DAG, getCurSDLoc(),
>                        SDValue(RetOp.getNode(), RetOp.getResNo() + j),
> 
> EMAIL PREFERENCES
>  http://reviews.llvm.org/settings/panel/emailpreferences/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150104/33c0ea8e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6834.17781.patch
Type: application/octet-stream
Size: 2096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150104/33c0ea8e/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150104/33c0ea8e/attachment-0001.html>


More information about the llvm-commits mailing list