[clang] Is truncating/extending array index still necessary?

When emitting array subscripts, clang extends or truncate the index type to the size of a pointer (lib/CodeGen/CGExpr.cpp:2260). This code was added in a very initial commit. Is it still necessary given gep supports any-width integers as an array index (http://llvm.org/docs/LangRef.html#id180)?

Jingyue

When emitting array subscripts, clang extends or truncate the index type to the size of a pointer (lib/CodeGen/CGExpr.cpp:2260). This code was added in a very initial commit. Is it still necessary given gep supports any-width integers as an array index (http://llvm.org/docs/LangRef.html#id180)?

Jingyue

It is not necessary, in general. It is the form that the optimizer prefers,
though the optimizer knows how to transform code to this form on its own.
Having clang do it means the optimizer has less to do, though probably not
a lot less.

Dan