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?