diff options
author | Pekka Enberg <penberg@kernel.org> | 2011-08-30 20:26:57 +0300 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2011-08-30 20:28:46 +0300 |
commit | 014de231b87ad9ba3f62b21abd4a591de742a5f4 (patch) | |
tree | f8c9664addc2e43e5ef7560bc2527615091f8151 | |
parent | be40b1a0e49a97f084c67d2ffc866b1445445d44 (diff) | |
download | sparse-014de231b87ad9ba3f62b21abd4a591de742a5f4.tar.gz |
Revert "sparse, llvm: Don't redefine module local functions"
This reverts commit be40b1a0e49a97f084c67d2ffc866b1445445d44.
Jeff Garzik explains:
That last commit isn't quite right. The code before wasn't quite right either,
but the new commit doesn't do a whole lot:
commit be40b1a0e49a97f084c67d2ffc866b1445445d44
Author: Pekka Enberg <penberg@kernel.org>
Date: Tue Aug 30 18:10:25 2011 +0300
sparse, llvm: Don't redefine module local functions
Signed-off-by: Pekka Enberg <penberg@kernel.org>
First problem: we already have a list of function calling conventions cached
for use. That is what llfunc_list is.
However... this is _very wrong_ for varargs functions. Your commit changes to
using an LLVM list from a local list, but that does not fix the problem.
This test case should demonstrate the broken code:
int foo(int x, int y)
{
printf("%d\n", x);
printf("%d, %d\n", x, y);
return 0;
}
The first printf() cached [incorrectly] the list of arguments. c.f. this code
comment:
/* to avoid strangeness with varargs [for now], we build
* the function and type anew, for each call. This
* is probably wrong. We should look up the
* symbol declaration info.
*/
-rw-r--r-- | sparse-llvm.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/sparse-llvm.c b/sparse-llvm.c index a4523795..bf7389c9 100644 --- a/sparse-llvm.c +++ b/sparse-llvm.c @@ -523,11 +523,6 @@ static LLVMValueRef get_function(struct function *fn, struct instruction *insn) return f->func; /* found match; return */ } END_FOR_EACH_PTR(f); - /* search for module local functions */ - func = LLVMGetNamedFunction(fn->module, buffer); - if (func) - return func; - /* build function type definition */ LLVMTypeRef func_type = get_func_type(fn, insn); |