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

Dan Gohman dan433584 at gmail.com
Thu Apr 17 23:38:35 PDT 2014


On Thu, Apr 17, 2014 at 12:33 PM, Jingyue Wu <jingyue at google.com> wrote:

> 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)?
>

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140417/17bb4906/attachment.html>


More information about the llvm-dev mailing list