search for: func2

Displaying 20 results from an estimated 76 matches for "func2".

Did you mean: func
2009 Jun 18
2
[LLVMdev] Query on optimizing away function calls.
Hi all. Consider the following code: ------------ define void @func() { %a = alloca i32 store i32 42, i32* %a call void @func2(i32* %a) nounwind ret void } define void @func2(i32* %a) nounwind { store i32 43, i32* %a ret void } ------------ It is possible to optimize this to: ------------ define void @func() { ret void } define void @func2(i32* %a) nounwind { store i32 43, i32* %a ret void...
2013 Oct 29
1
[LLVMdev] JIT'ing 2 functions with inter-dependencies
I am having problems JIT'ing 2 functions where one of them calls the other. (I am using the old JIT interface). Here is the setup: define void @func1() { entrypoint: call void @func2(void) ret void } define void @func2(void) { entrypoint: ret void } (I omit the arguments and function bodies for simplicity.) It's 'func1' that would be called from host code, 'func2' gets only called from 'func1'. The time I have finished building 'func1&...
2011 Sep 06
2
Generalizing call to function
Hello guys, I would like to ask for help to understand what is going on in "func2". My plan is to generalize "func1", so that are expected same results in "func2" as in "func1". Executing "func1" returns... 0.25 with absolute error < 8.4e-05 But for "func2" I get... Error in dpois(1, 0.1, 23.3065168689948, 0.0004290645...
2009 Jun 18
0
[LLVMdev] Query on optimizing away function calls.
Hi, > Consider the following code: > > ------------ > define void @func() { > %a = alloca i32 > store i32 42, i32* %a > call void @func2(i32* %a) nounwind > ret void > } > > define void @func2(i32* %a) nounwind { > store i32 43, i32* %a > ret void > } > ------------ > > It is possible to optimize this to: > > ------------ > define void @func() { > ret void > } > &gt...
2015 Dec 01
3
LICM doesn't work for IntrReadMem intrinsic function
...5 at 12:33, Xiangyang Guo via llvm-dev <llvm-dev at lists.llvm.org> wrote: > if I have the following IR, LICM doesn't work again, even if I use > '-loop-rotate' firstly. In this IR, the return value of intrinsic function > "foo" is used by another function "func2" as parameter. However, for the > intrinsic function "foo", the parameters are still loop invariant. Do you > know why this happens? Thanks a lot. Is there anything telling LLVM that func2 won't write to memory and change the value returned by llvm.foo? Cheers. Tim.
2009 Sep 14
1
[LLVMdev] How to split module?
Hi, all. My question is about how to split one module into N modules(N >= 2)? For example, given the following code: #src.c# int main() { //......// func1(); func2(); //......// return 0; } void func1() { //......// } void func2() { //......// } func1() has no dependence with func2(), so they can perform parallel execution. And I have to split src.c into src1.c and src2.c instead of using thread library, because the target machine has multi...
2009 Jun 18
1
[LLVMdev] Query on optimizing away function calls.
....8020707 at free.fr> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Hi, > > > Consider the following code: > > > > ------------ > > define void @func() { > >    %a = alloca i32 > >    store i32 42, i32* %a > >    call void @func2(i32* %a) nounwind > >    ret void > > } > > > > define void @func2(i32* %a) nounwind { > >    store i32 43, i32* %a > >    ret void > > } > > ------------ > > > > It is possible to optimize this to: > > > > ------------ > &g...
2003 Jun 09
1
Questions for package ts prediction
Dear helpers, I am trying to write a function to return prediction values using package ts. I have written three different versions since I am not sure what's wrong with my func2. func and func1 return the same results.But func1 and func2 don't. In particular, the only difference between "func1" and "func2" is the function variable name being y and data, respectively. But running the last line of the following script will give the message: Error in...
2016 Sep 21
3
Propagation of debug information for variable into basic blocks.
...at is compiled at optimisations other than -O0 The main problem appears to be with the LiveDebugValues::join() method because it does not allow variables to be propagated into blocks unless all predecessor blocks have an Outgoing Location for that variable. As a simple example in the C code: int func2( int); void func(int a) { int b = func2(10); for(int i = 1; i < a; i++) { func2(i+b); } } One would reasonable expect when stopped within the body of the for loop that you could access the variable b in a debugger (especially as it is actually referenced...
2011 Feb 17
1
Integrate with an indicator function
...ction containing an indicator function. please see the code below: func1 <- function(x, mu){ (mu^2)*dnorm(x, mean = mu, sd = 1)*dgamma(x, shape=2)} m1star <- function(x){ integrate(func1, lower = 0, upper = Inf,x)$val} T <- function(x){ 0.3*dnorm(x)/(0.3*dnorm(x)+0.7*m1star(x))} func2 <- function(x,c){(T(x) <=c)*0.3*dnorm(x)} func3 <- function(x,c){(T(x) <= c)*(0.3*dnorm(x)+0.7*m1star(x))} numer <- function(c){ integrate(func2, -Inf, Inf, c)$val} denom <- function(c){ integrate(func3, lower, Inf,c)$val} The error message is as below : > numer(0.5)...
2019 May 17
3
Copy Function from one LLVM IR file to another
...rator F1; Module::iterator F2; *5.* Assign them values so that F1 points to the first function and F2 to the second function: for(Module::iterator func = Mod_ptr->begin(), Lfunc = Mod_ptr->end(); func!=Lfunc; ++func) { F1 = func; } for(Module::iterator func2 = Mod_ptr2->begin(), Lfunc2 = Mod_ptr2->end(); func2!=Lfunc2; ++func2) { if(func2->getName() == F.getName()) //F.getName() gives the same name as the function that was extracted { F2 = func2; } } *6.* Replacing each instruction of...
2007 Nov 26
3
Communicating from one function to another
My question is a seemingly simple one. I have a bunch of user-defined functions which compute such-and-such objects. I want to be able to define a variable in a particular function, then make use of it later, perhaps in a different function, without necessarily having to move it around in argument lists. In the C community, it would be called a "global" variable. Question 1: Is this
2000 Sep 06
2
reusing external functions across libs
...yn.load()ing both libraries. But unfortunately this seems to depend very crucially on the specific OS. An example (C/Fortran mix, but I tried also C/C and Fortran/Fortran): **** so1.c ******************* #include <R.h> void func1(double* a, int* n){ printf("in func1\n"); F77_SYMBOL(func2)(a,n); printf("back in func1\n"); } ****************************** gcc -g -fpic -c so1.c -I/usr/local/lib/R/include ld -shared so1.o -o so1.so **** so2.f ******************* subroutine func2(a,n) real*8 a(*) integer n integer i call intpr("in...
2015 Apr 19
2
[LLVMdev] LLVM IR for inline functions
Hi, I have a naive question on how to generate LLVM IR for inline functions. I have compiled this C code: *inline void func1()* * {* * int x=3;* * }* * void func2()* * {* * func1();* * int y = 4;* * }* into LLVM IR, using clang -emit-llvm -S -c <filename> But the generated LLVM IR file does *not* have func1() expanded (see below for the relevant parts). *; Function Attrs: nounwind uwtable* * define void @func2() #0 {* * entry:* * %y = alloca i32,...
2007 Jun 01
2
Getting names of objects passed with "..."
...nc1 <- function(...) { nms <- rownames(rbind(..., deparse.level=1)) print(nms) } x <- "some stuff" second <- "more stuff" test.func1(first=x, second) [1] "first" "second" The usual 'deparse(substitute())' doesn't do it: test.func2 <- function(...) { nms <- deparse(substitute(...)) print(nms) } test.func2(first=x, second) [1] "x" I'm using "nms <- rownames(rbind(...))" as a workaround, which works, but there must be a neater way! rbind/cbind are .Internal, so I can't pinch code fro...
2011 Feb 17
1
Integration with an Indicator Function in R
...nction containing an indicator function. please see the code below: func1 <- function(x, mu){ (mu^2)*dnorm(x, mean = mu, sd = 1)*dgamma(x, shape=2)} m1star <- function(x){ integrate(func1, lower = 0, upper = Inf,x)$val} T <- function(x){ 0.3*dnorm(x)/(0.3*dnorm(x)+0.7*m1star(x))} func2 <- function(x,c){(T(x) <=c)*0.3*dnorm(x)} func3 <- function(x,c){(T(x) <= c)*(0.3*dnorm(x)+0.7*m1star(x))} numer <- function(c){ integrate(func2, -Inf, Inf, c)$val} denom <- function(c){ integrate(func3, lower, Inf,c)$val} The error message is as below : > numer(0.5)...
2010 Jun 16
3
[LLVMdev] Strange pointer aliasing behaviour
...int i=0; i<length; i++ ) _data[i] = 0; } }; class LittleList2 { public: int _length; double _data[ little_list_size ]; LittleList2( int length ) { _length = length; for( int i=0; i<_length; i++ ) _data[i] = 0; } }; int func1() { LittleList1 l(4); return l._length; } int func2() { LittleList2 l(4); return l._length; } /* END SOURCE CODE */ The only difference between the 2 classes is in the constructor, in the line : for( int i=0; i<_length; i++ ) One has "length" which is a function parameter, the other has "_length" which is the class m...
2015 May 04
2
[LLVMdev] Semantics of an Inbounds GetElementPtr
On Mon, May 4, 2015 at 9:40 AM, Nicholas White <n.j.white at gmail.com> wrote: > Thanks - that makes sense. It's interesting that at -O3 the optimizer > can't reduce the below though - I'll dig into it a bit and see if I > can make a patch that fixes it: I'm unsure what you expect to happen below. It's not quite the same testcase. GVN will PRE the loads, so you
2011 Nov 30
0
[LLVMdev] -Wunreachable-code and templates
I'm just wondering if anyone's already working on addressing the current shortcomings around -Wunreachable-code in regards to templates. Take the following simple example: $ cat unreachable.cpp int func1(); int func2(); template<bool b> int func() { return !b ? func1() : func2(); } int main() { return func<true>() + func<false>(); } $ clang++ -Wunreachable-code unreachable.cpp unreachable.cpp:5:15: warning: will never be executed [-Wunreachable-code] return !b ? func1() : func2();...
2009 Mar 30
1
[LLVMdev] Determining the base offset of the stack for a function.
I am running into an issue where if I have multiple functions compiled in the same compilation unit the stack offset is not starting at zero. For example: func1(...) { ... } func2(...) { ... } Say the first function uses 64 bytes of the stack and an assumed offset of 0 and the second function uses 32 bytes of the stack but an assumed offset of 64. I've found out how to get the size of the stack via MachineFrameInfo.StackSize/getObjectSize, however I have not found...