[patch] Respect llvm.used in Internalize

Nick Lewycky nlewycky at google.com
Wed Jul 24 16:57:37 PDT 2013


On 23 July 2013 04:32, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:

> > You probably know the right thing to do here better than I do. Mine was
> just
> > an "peephole" observation.
>
> I went ahead and implemented the option of passing a bool to select
> llvm.used or llvm.compiler.used.
>
> Nick, what do you think?
>

+    const Module &M, SmallPtrSet<GlobalValue *, 8> &Set, bool
CompilerUsed) {
+  const char *Name = CompilerUsed ? "llvm.compiler.used" : "llvm.used";
+  GlobalVariable *GV = M.getGlobalVariable(Name);

I think you just got a non-const IR* from a const Module. How'd you pull
that off? Module::getGlobalVariable shouldn't do that.

+  for (unsigned I = 0, E = Init->getNumOperands(); I != E; ++I) {

Isn't it normal to use i and e for ints and I and E for iterators?

Anyhow, this is fine. I mean, grumpy-Nick doesn't like @llvm.used or
@llvm.compiler.used, but I'll spare you my whining.

LGTM

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130724/fd57c28c/attachment.html>


More information about the llvm-commits mailing list