Details
Diff Detail
Event Timeline
llvm/lib/Analysis/CallGraph.cpp | ||
---|---|---|
85 | Typo: Ingore | |
llvm/lib/IR/Function.cpp | ||
1617 | Can you please add a test which has non-bitcast value of function pointers? Something like below; @llvm.used = appending global [2 x float()*] [void()* @foo, void()* @bar] IIRC, the above simple cast to GlobalVariable is not sufficient in this case. You need to handle it with some more extra checks. |
llvm/lib/IR/Function.cpp | ||
---|---|---|
1617 | Does this really happen? My understanding these arrays shall have i8* type, so a function pointer always needs a bitcast. |
(Passing comment not really related to the patch, but I wonder how hard / useful it would be to convert @llvm.used and @llvm.compiler.used to attributes (or similar)...?)
At the very least these variables are defined in the LLVM IR specification, so it would be a compatibility break.
Right, it'd certainly be a semantic change; we'd need an auto-upgrade for bitcode (surely no compatibility break there) and a transition of some sort for the C API (I imagine there's a reasonable way of handling both, but maybe you're seeing some difficulty?). Probably it could / should be modelled as part of the linkage somehow, rather than an attribute, but it might not be worth a bit on Value. (But probably this isn't the right venue to discuss this; carry on...)
llvm/lib/IR/Function.cpp | ||
---|---|---|
1582 | Need to enhance this comment to accommodate new arguments. | |
1586 | %s/Ingore/Ignore | |
1617 | Yes, as per the spec, "This array contains a list of pointers to named global variables, functions and aliases which may optionally have a pointer cast formed of bitcast or getelementptr". So the pointer cast is optional. You can have plain function pointers in the array. The newly added code will handle only bitcast cast case but not general. You need to handle the general case and find if one of the users if GlobalVariable. @llvm.used = appending global [2 x void()*] [void()* @foo, void()* @bar] |
Fixed typo.
llvm/lib/IR/Function.cpp | ||
---|---|---|
1617 | This is already done in the previous patch. I still think that does not practically happen because you cannot have elements of different types in an array. The words "may optionally have a pointer cast" shall apply if your pointer is not of the i8* type (since this variable is not only used for functions). For sure one can artificially forge such initializer (like I did in the test), but that does not have much practical sense. |
llvm/lib/IR/Function.cpp | ||
---|---|---|
1617 | Two questions:
@llvm.used = appending global [2 x void()*] [void()* @foo, void()* @bar] I don't see verifier complain about it, which make me believe that it is a valid LLVM construct. Are you saying that it is not common so you'd like to skip it?
|
llvm/lib/IR/Function.cpp | ||
---|---|---|
1617 |
|
Typo: Ingore