I figured out the issue and posted a patch [1] to the commits ml.
Cheers,
Shea
[1]
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140203/204401.html
On Mon, Feb 03, 2014 at 11:14:26PM -0500, Shea Levy
wrote:> Hi all,
>
> I'm using a library (the llvm-general haskell library, if it matters)
> that uses the PassManagerBuilder interface to build a PassManger given
> an optimization level, etc. I've extended this to make it possible to
> set the PassManagerBuilder's LibraryInfo member, and as a test I
created
> a TargetLibraryInfo where LibFunc::malloc was set to
"GC_malloc_atomic"
> (the allocator for boehm-gc). I've verified that, just before building
> the PassManager, pmb->LibraryInfo->getName(LibFunc::malloc) does
indeed
> return "GC_malloc", yet when I use the PassManager on a module
with a
> call to GC_malloc whose return value isn't used the call is not
> optimized away, while it is when I replace that GC_malloc call with a
> call to malloc. Am I misunderstanding the point of LibraryInfo here, or
> is something not working correctly? I am using llvm-3.4.
>
> Thanks,
> Shea Levy