similar to: Is llvm capable of doing loop interchange optimization?

Displaying 20 results from an estimated 100 matches similar to: "Is llvm capable of doing loop interchange optimization?"

2018 Apr 03
1
Ineffective code after loop unrolling with -O3, ok with -Os
Hi all, I found some issues during my testing of "loop unrolling" capabilities of LLVM's opt. Seems like LLVM generates slower code with -O3 since it wrongly decides to unroll a simple loop. With option -Os, no loop unrolling, the output looks well. Code:
2012 Oct 30
4
horizontal space/indent and HTML/PDF
What is the best method to introduce horizontal space in text in a Pandoc document? Preferably something that would work for both HTML and PDF output? I need this for some poetry that has indented lines, ala the 2nd and 3rd lines: hickory dickory dock the most ran up the clock the clock struck one the mouse ran down c -- Chris Lott <chris at chrislott.org>
2012 Jan 24
4
[LLVMdev] Pointer aliasing
Can you explain please why it works for this version of the function: double f(double *__restrict__ x, double *__restrict__ y, double *__restrict__ z); What is different here? There are stores here as well. Brent On Wed, Jan 25, 2012 at 12:34 AM, Roel Jordans <r.jordans at tue.nl> wrote: > Hi Brent, > > I think this is a problem in the easy-cse transform. In this transform
2012 Jan 24
2
[LLVMdev] Pointer aliasing
Hi Roel, the code you list below is precisely what I expect to get (of course the stores must happen but the constant folding should happen as well). It all looks very strange. LLVM is behaving as if the __restrict__ keyword was not used at all. Even more strange is the fact that for this function: double f(double *__restrict__ x, double *__restrict__ y, double *__restrict__ z) { *x = 1.0;
2012 Jan 24
2
[LLVMdev] Pointer aliasing
I think the problem here is that the IR doesn't have any way to attach restrict information to loads/stores/pointers. It works on arguments because they can be given the 'noalias' attribute, and then the alias analyzer must understand what that means. Pete On Jan 24, 2012, at 7:47 AM, Roel Jordans wrote: > I have no clue, I didn't have time to look into that example yet.
2009 Jul 30
2
z[i,j] = x[i,j] * y(i+j) ?
For the life of me I couldn't work out what to searc I have an m*n numeric matrix x and a numeric vector y (of length m+n-1) How do I do a calculation like this? z[i,j] = x[i,j] * y[i+j] ? Well, one can write a pair of loops, or write a single loop within which we calculate a vector at a time, but ... is there a "neat" way to do it? tiny example:
2012 Jan 23
2
[LLVMdev] Pointer aliasing
Hi LLVMers, I would like to ask a question regarding aliasing. Suppose I have the following program: double f(double** p ) { double a,b,c; double * x = &a; double * y = &b; double * z = &c; *x = 1; *y = *x + 2; *z = *x + 3; return *x+*y+*z; } LLVM can tell that the three pointers do not alias each other so can perform the constant folding at compile time.
2012 Jan 25
4
[LLVMdev] Pointer aliasing
Thank you for your reply. The compromise you describe below, is it a compromise in the LLVM back end or in clang? I run into this while building a compiler for a small DSL language for which I generate functions that receive a context from which they extract a bunch of pointers to doubles from which inputs are passed to the function (I just used C/clang in my examples to illustrate the problem).
2008 Jan 16
2
Memory Leak
So, I''ve stumbled across bleak_house (http://blog.evanweaver.com/files/doc/fauna/bleak_house/files/README.html) - this looks like it may help me track down what is causing the Memory leak I''m seeing (be it me, Ubuntu, Debian, or Puppet). First step: I''m going to clone the repo, branch Second step: Learn Ruby - shouldn''t be too hard. Third step: Do exactly what
2012 Jan 24
0
[LLVMdev] Pointer aliasing
Hi Brent, I think this is a problem in the easy-cse transform. In this transform load operations can be replaced by their subexpression, in this case the propagated constant, based on the value of the 'CurrentGeneration' of memory writes. This implies that any store operation invalidates the knowledge about previously stored subexpressions. In general, this is a safe assumption but
2012 Jan 24
0
[LLVMdev] Pointer aliasing
I have no clue, I didn't have time to look into that example yet. How does the IR (before optimization) differ from the other version? Roel On 01/24/2012 04:45 PM, Brent Walker wrote: > Can you explain please why it works for this version of the function: > > double f(double *__restrict__ x, double *__restrict__ y, double > *__restrict__ z); > > What is different here?
2012 Jan 24
0
[LLVMdev] Pointer aliasing
On Jan 24, 2012, at 7:45 AM, Brent Walker wrote: > Can you explain please why it works for this version of the function: > > double f(double *__restrict__ x, double *__restrict__ y, double > *__restrict__ z); > > What is different here? There are stores here as well. LLVM ignores restrict everywhere except function parameters. This is a compromise aimed at a sweet spot in
2012 Jan 25
0
[LLVMdev] Pointer aliasing
Hi Brent, > Unless I can mark these extracted pointers as non-aliasing, performance > suffers a lot. It's not just CSE that suffers -- LLVM does not do > copy propagation either so we keep loading the same values from memory > over and over again. See the example here: > > double f(double a, double * x, double *y, double * z) > { > *x = a; > *y = a+1; >
2012 Jan 24
0
[LLVMdev] Pointer aliasing
Peter Cooper wrote: > I think the problem here is that the IR doesn't have any way to attach restrict information to loads/stores/pointers. I think we do now, actually. Now that the loads and stores have TBAA metadata, I think the restrict attribute can go there. It needs to be attached to every use of a restrict pointer, but that's similar to how TBAA already works. > It works
2012 Jan 25
1
[LLVMdev] Pointer aliasing
Hi Duncan, you have misunderstood me I think. Of course in this case you have to reload the doubles since as you say the pointers may be aliasing each other. I just wrote it this way to show the kind of code one gets if one cannot specify that pointers do now alias -- not adding the __restrict__ to the function arguments gives the same code as in my example with the local variables (with or
2012 Jan 24
0
[LLVMdev] Pointer aliasing
Hi Brent, Looking at your code I can see at least one reason why some of the store operations remain in the output since you are (through x, y, and z) writing in memory which exists outside of your function (p). Constant propagation also seems to work in the first few lines, *y = *x +1 (%3) is stored directly. The strange thing to me is that the same doesn't happen for *z = *x + 2. Here
2015 Jan 08
1
New version of Rtools for Windows
Oh, I forgot to mention that besides setting AR, RANLIB and the stack probing fix, you also need a very up to date binutils. 2.25 was out in december. Even with that , if you linker's default is not what you are compiling for (i.e. a multiarch toolchain), you need to set GNUTARGET also, i.e. -m32/-m64 is not enough. Some fix to autodetect non-default targets went in after christmas before the
2013 Nov 11
2
[LLVMdev] What's the Alias Analysis does clang use ?
Hi, LLVM community: I found basicaa seems not to tell must-not-alias for __restrict__ arguments in c/c++. It only compares two pointers and the underlying objects they point to. I wonder how clang does alias analysis for c/c++ keyword restrict. let assume we compile the following code: $cat myalias.cc float foo(float * __restrict__ v0, float * __restrict__ v1, float * __restrict__ v2, float *
2020 Jun 28
2
__restirct ignored when including headers like <cmath>
Hi, I am observing a strange behaviour in which Clang ignores __restirct when I include some standard headers. For example, this code: void vec_add(int* __restrict a, int* __restrict b, int n) { #pragma unroll 4 for(int i=0; i<n; ++i) { a[i] += b[i]; } } results in: ; Function Attrs: nofree norecurse nounwind define dso_local void @_Z7vec_addPiS_i(i32*
2013 Oct 31
3
[LLVMdev] loop vectorizer misses opportunity, exploit
Hi Frank, This loop should be vectorized by the SLP-vectorizer. It has several scalars (C[0], C[1] … ) that can be merged into a vector. The SLP vectorizer can’t figure out that the stores are consecutive because SCEV can’t analyze the OR in the index calculation: %2 = and i64 %i.04, 3 %3 = lshr i64 %i.04, 2 %4 = shl i64 %3, 3 %5 = or i64 %4, %2 %11 = getelementptr inbounds float*