[PATCH] When canonicalizing gep indices, prefer zext when possible

Philip Reames listmail at philipreames.com
Thu Feb 12 10:14:49 PST 2015


ping

On 01/29/2015 08:21 AM, Philip Reames wrote:
> Hi baldrick, craig.topper, sunfish, echristo, tstellarAMD,
>
> We eagerly canonicalize gep indices to the width of a machine register (i64 on x86_64).  To do so, we insert sign extensions (sext) to promote smaller types.  This change substitutes zero extensions where we know the value being extended is positive.  This is motivated by the fact that zero extensions are generally cheaper on x86.
>
> Q for reviewer: Should this be behind a target hook?  If so, which and how?
>
> On a broader topic, I don't really get why we're canonicalizing this way at all.  Does anyone have a strong reason why this is right approach?
>
> http://reviews.llvm.org/D7255
>
> Files:
>    lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
>    lib/Transforms/InstCombine/InstCombineCasts.cpp
>    lib/Transforms/InstCombine/InstructionCombining.cpp
>    test/CodeGen/X86/gep-sext.ll
>    test/Transforms/InstCombine/gep-sext.ll
>
> EMAIL PREFERENCES
>    http://reviews.llvm.org/settings/panel/emailpreferences/




More information about the llvm-commits mailing list