Inlining problem of core.bitops

jkrempus at jkrempus at
Sat Dec 28 04:13:06 PST 2013

> Can't ldc2 replace a call to core.bitop.bsf with the llvm intrinsic?

It would be possilbe to add an ldc intrinsic that
would tell ldc to do that. But I think it would be a better, more general
solution to add a forceinline attribute that would force compilation of 
function body whether the containing module was on the command line or 
not, and mark the resulting function as alwaysinline. 

It is currently almost possible to implement bsf using LDC_inline_ir
(which we result in bsf being always inlined).
The only problem is that the the compilation will fail if llvm intrinsic
llvm.cttz.i64 isn't declared at the time when inline ir is parsed. It 
may be possible to fix this behavior of LDC_inline_ir.

More information about the digitalmars-d-ldc mailing list