]> granicus.if.org Git - clang/commit
Call the correct @llvm.objectsize.
authorGeorge Burgess IV <george.burgess.iv@gmail.com>
Wed, 22 Feb 2017 02:35:51 +0000 (02:35 +0000)
committerGeorge Burgess IV <george.burgess.iv@gmail.com>
Wed, 22 Feb 2017 02:35:51 +0000 (02:35 +0000)
commitcefec9cba5ec1629aac083bad2ad7e10e91dcf05
treeaa3253096e26b585a133db4a66a865e35de110df
parentd6496f0a0eeb80dc778e0141711397b1402e591b
Call the correct @llvm.objectsize.

The following code would crash clang:

void foo(unsigned *const __attribute__((pass_object_size(0))));
void bar(unsigned *i) { foo(i); }

This is because we were always selecting the version of
`@llvm.objectsize` that takes an i8* in CodeGen. Passing an i32* as an
i8* makes LLVM very unhappy.

(Yes, I'm surprised that this remained uncaught for so long, too. :) )

As an added bonus, we'll now also use the appropriate address space when
emitting @llvm.objectsize calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295805 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGBuiltin.cpp
test/CodeGen/pass-object-size.c