Jingyue Wu
2014-Apr-17 19:33 UTC
[LLVMdev] [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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140417/b67d650f/attachment.html>
Dan Gohman
2014-Apr-18 06:38 UTC
[LLVMdev] [clang] Is truncating/extending array index still necessary?
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>