-inline odd behavior

I have some code that has one function and if I use the-inline on it then these opts eliminate the entire function (which is the entire file).

Bugpoint produces bugpoint-reduced-simplified.bc, but when I then run “opt bugpoint-reduced-simplified.bc -inline” I get nothing, file get emptied.

It doesn’t crash or assert. I have attached a test case.

inline_test.ll (13.5 KB)

Your function has internal linkage and no uses; therefore, your .ll
file is equivalent to the empty .ll file.

-Eli

Seems like bad behavior to just decide to delete the function, no? Why not just ignore it then and output the input?

Seems like bad behavior to just decide to delete the function, no? Why not
just ignore it then and output the input?

Deleting dead functions is part of the functionality of -inline.

-Eli

Yes, that makes sense but not if it isn’t doing anything with it. If it doesn’t inline it then it shouldn’t be modifying it, or at least that’s what makes sense to me. If part of it’s job is to delete functions that were created “dead” by some other opt, then shouldn’t that opt be deleting the functions it makes dead?

I guess I don’t see the point in deleting functions (even dead ones) that it doesn’t touch, what’s the point? Why bother to even compile those functions then? It’s not like clang or llvm-gcc gives me an empty function, only “-inline”?

Correction, on the last sentence in the second segment, that is incorrect. They do.