Bugzilla – Bug 290
Bugpoint doesn't support uses of external fns by immediate constant exprs
Last modified: 2004-04-18 21:52:42
You need to log in before you can comment on or make changes to this bug.
I hit the "UNSUPPORTED: external function used as a global initializer!" abort in bugpoint today, and I think a relatively simple enhancement to make would be to support things like %tmp.16 = call %struct.line* (...)* cast (%struct.line* ()* %next_active_node to %struct.line* (...)*)( ) You get things like this when you have K&R style function prototypes. We could attack this by specifically checking for constant cast exprs that are not wrapped in anything and only used in a single call instruction. But a more general solution would be to check that the function's use is a constant expr such that 1) the constant expr has only one use 2) the constant expr's use is either a) an instruction, or b) a constant expr conforming to 1) & 2).
This is definitely related to Bug 38. If you run into this problem, you could try running the instcombine pass, which cleans up cruft like this. I'm not sure if its really worth hacking around this "missing feature", instead we could just fix it outright... -Chris
Well, by way of explanation, I was running into this particular special case a lot, and I thought it might be worth consideration because it's not *really* an external function being used as a global initializer; in fact, it's not even a non-instruction using an external function. It's just that bugpoint can't see through the cast.
Fixed: http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040412/013905.html