Displaying 20 results from an estimated 20000 matches similar to: "[LLVMdev] Loops Prevent Function Pointer Inlining?"
2016 Aug 25
4
Canonicalize induction variables
But even for a very simple loop:
int test1 (int *x, int *y, int *z, int k) {
int sum = 0;
for (int i = 10; i < k; i++) {
z[i] = x[i] / y[i];
}
return sum;
}
The initial value of induction variable is not zero after compiling with
-O3 -mcpu=power8 x.cpp -S -c -emit-llvm -fno-unroll-loops (see bottom of
the email for IR)
Also I can write somewhat more complicated loop where step
2014 Sep 24
3
[LLVMdev] Loops Prevent Function Pointer Inlining?
I've CC'ed Chad Rosier as I think this behaviour is a side-effect of
his revert of IndVarSimplify.cpp (git
c6b1a7e577a0b9e9cff9f9b7ac35a2cde7c448d8, SVN 217962). The change
basically makes the IndVar pass change:
; <label>:4 ; preds = %6, %0
%i.0 = phi i32 [ 0, %0 ], [ %11, %6 ]
%5 = icmp eq i32 %i.0, 0
br i1 %5, label %6, label %17
To:
2014 Sep 02
2
[LLVMdev] Preserving NSW/NUW bits
David/All,
Just a quick question about NSW/NUW bits, if you've got a second. I
noticed you've been doing a little work on this as of late.
I have a bit of code that looks like the following:
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = add i64 %indvars.iv.next, -1
%tmp = trunc i64 %2 to i32
%cmp = icmp slt i32 %tmp, %0
br i1 %cmp, label %for.body, label
2015 Aug 22
3
loop unrolling introduces conditional branch
Hi, Mehdi,
For example, I have this very simple source code:
void foo( int n, int array_x[])
{
for (int i=0; i < n; i++)
array_x[i] = i;
}
After I use "clang -emit-llvm -o bc_from_clang.bc -c try.cc", I get
bc_from_clang.bc. With my code (using LLVM IRbuilder API), I get
bc_from_api.bc. Attachment please find thse two files. I also past the IR
here.
2015 Aug 22
2
loop unrolling introduces conditional branch
Thanks for your point that out. I just add DataLayout in my code such as
"mod->setDataLayout("e-m:e-i64:64-f80:128-n8:16:32:64-S128");", still no
luck.
I'm really confused about this. Do I need to add more passes before
-loop-unroll?
On Sat, Aug 22, 2015 at 11:36 AM, Mehdi Amini <mehdi.amini at apple.com> wrote:
>
> On Aug 22, 2015, at 7:27 AM, Xiangyang
2015 Aug 13
2
[LLVMdev] Improving loop vectorizer support for loops with a volatile iteration variable
Hi Gerolf,
I think we have several (perhaps separable) issues here:
1. Do we have a canonical form for loops, preserved through the optimizer, that allows naturally-constructed loop nests to remain separable?
2. Do we forbid non-lowering transformations that turn vectorizable loops into non-vectorizable loops?
3. How do we detect cases where transformations cause a negative answer to either
2016 Aug 25
3
Canonicalize induction variables
I just subscribed this group. This is my first time to post a question
(not sure if this is a right place for discussion) after I have a brief
look at LLVM OPT (dev trunk). I would expect loop simplification and
induction variable canonicalization pass (IndVarSimplify pass) should be
able to convert the following loops into a simple canonical form, i.e.,
there is a canonical induction variable
2016 May 19
4
GEP index canonicalization
Hi,
InstCombine canonicalizes index operands (unless they are into struct
types) to pointer size. The comment says: "If we are using a wider
index than needed for this platform, shrink it to what we need. If
narrower, sign-extend it to what we need. This explicit cast can make
subsequent optimizations more obvious.".
For our architecture, the canonicalization is a bit
2014 Jan 16
3
[LLVMdev] Loop unrolling opportunity in SPEC's libquantum with profile info
On Wed, Jan 15, 2014 at 5:30 PM, Nadav Rotem <nrotem at apple.com> wrote:
> Was the vectorizer successful in unrolling the loop in quantum_sigma_x? I
> wonder if 'size’ is typically high or low.
No. The vectorizer stated that it wasn't going to bother with the loop
because it wasn't profitable. Specifically:
LV: Checking a loop in "quantum_sigma_x"
LV: Found a
2012 Mar 08
2
[LLVMdev] -indvars issues?
Hi,
Is the -indvars pass functional? I've done some small test to check it, but this fails to canonicalize:
> int *x;
> int *y;
> int i;
> ...
> for (i = 1; i < 100; i+=2) {
> x[i] = y[i] + 3;
> }
The IR produced after -indvars:
> br label %for.cond
>
> for.cond: ; preds = %for.inc, %entry
> %indvars.iv =
2016 Sep 16
2
SCEV cannot compute the trip count of Simple loop
Hi All,
I am trying to unroll the below loop, but couldn't as SCEV returns TripCount as 0.
void foo(int x) {
int p, i = 1;
int mat[6][6][6];
for (p = x+3 ; p<= x+6 ;p++)
mat[x][p][i] = mat[x][p][i] + 5;
}
For a quick reference I have added the generated IR compiled with clang using -O3.
Please let me know if this is an known issue in SCEV or I am missing something here ?
;
2015 Jul 16
4
[LLVMdev] Improving loop vectorizer support for loops with a volatile iteration variable
----- Original Message -----
> From: "Hal Finkel" <hfinkel at anl.gov>
> To: "Chandler Carruth" <chandlerc at google.com>
> Cc: llvmdev at cs.uiuc.edu
> Sent: Thursday, July 16, 2015 1:58:02 AM
> Subject: Re: [LLVMdev] Improving loop vectorizer support for loops
> with a volatile iteration variable
> ----- Original Message -----
> >
2013 Jun 25
2
[LLVMdev] SimplifyIndVar looses nsw flags
Hello,
I'm using LLVM to reason about memory safety of programs. One goal is to
prove that certain array accesses are always safe.
Currently, one of these proofs fails because of a missing no-signed-wrap
(nsw) flag. I found that it has been "lost" during the SimplifyIndVar pass.
Here's the example:
int foo(int a[]) {
int sum = 0;
for (int i = 0; i < 1000; ++i)
2017 Dec 19
4
MemorySSA question
Hi,
I am new to MemorySSA and wanted to understand its capabilities. Hence I
wrote the following program (test.c):
int N;
void test(int *restrict a, int *restrict b, int *restrict c, int *restrict
d, int *restrict e) {
int i;
for (i = 0; i < N; i = i + 5) {
a[i] = b[i] + c[i];
}
for (i = 0; i < N - 5; i = i + 5) {
e[i] = a[i] * d[i];
}
}
I compiled this program using
2016 Sep 16
3
SCEV cannot compute the trip count of Simple loop
I have modified the example test case for UB error, still it didn’t unroll
void foo(int x) {
int p, i = 1;
int mat[9][9][9];
for (p = (x+1) ; p < (x+3) ;p++)
mat[x][p-1][i] = mat[x][p-1][i] + 5;
}
Regard,
Deepali
From: Kevin Choi [mailto:code.kchoi at gmail.com]
Sent: Friday, September 16, 2016 1:20 PM
To: Rai, Deepali
Cc: llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] SCEV
2013 Oct 31
2
[LLVMdev] SCEV and GEP NSW flag
Andy, et al.,
If I start with C code like this:
void foo(long k, int * restrict a, int * restrict b, int * restrict c) {
if (k > 0) {
for (int i = 0; i < 2047; i++) {
a[i] = a[i + k] + b[i] * c[i];
}
}
}
Clang -O3 will produce code like this:
entry:
%cmp = icmp sgt i64 %k, 0
br i1 %cmp, label %for.body.preheader, label %if.end
for.body.preheader:
br label
2017 Dec 19
2
MemorySSA question
On Tue, Dec 19, 2017 at 9:10 AM, Siddharth Bhat via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> I could be entirely wrong, but from my understanding of memorySSA, each
> def defines an "abstract heap state" which has the coarsest possible
> definition - any write will be modelled as a "new heap state".
>
This is true for def-def relationships, but
2013 Oct 23
2
[LLVMdev] First attempt at recognizing pointer reduction
On 21 October 2013 17:29, Arnold Schwaighofer <aschwaighofer at apple.com>wrote:
> I don’t think that recognizing this as a reduction is going to get you
> far. A reduction is beneficial if the value reduced is only truly needed
> outside of a loop.
> This is not the case here (we are storing/loading from the pointer).
>
Hi Arnold, Nadav,
Let me resurrect this discussion a
2015 Aug 22
2
loop unrolling introduces conditional branch
Hi,
I just tried llvm-3.8 (LLVM SVN Repository). With this version, -fno-rtti
can help me to compile my code and -irce can help me to do a better job for
loop unrolling. However, I still have one question. If I use Clang to
compile a piece of c++ code to .bc and then use 'opt -loop-rotate
-loop-unroll -irce', I can get what I want. I mean, there is no conditional
branch at the end of each
2013 Nov 02
0
[LLVMdev] SCEV and GEP NSW flag
On Oct 31, 2013, at 1:24 PM, Hal Finkel <hfinkel at anl.gov> wrote:
> Andy, et al.,
>
> If I start with C code like this:
>
> void foo(long k, int * restrict a, int * restrict b, int * restrict c) {
> if (k > 0) {
> for (int i = 0; i < 2047; i++) {
> a[i] = a[i + k] + b[i] * c[i];
> }
> }
> }
>
> Clang -O3 will produce code like