search for: arrayidx2

Displaying 20 results from an estimated 80 matches for "arrayidx2".

Did you mean: arrayidx
2019 Nov 10
2
Reassociation is blocking a vectorization
Hi Devs, I am looking at the bug https://bugs.llvm.org/show_bug.cgi?id=43953 and found that following piece of ir %arrayidx = getelementptr inbounds float, float* %Vec0, i64 %idxprom %0 = load float, float* %arrayidx, align 4, !tbaa !2 %arrayidx2 = getelementptr inbounds float, float* %Vec1, i64 %idxprom %1 = load float, float* %arrayidx2, align 4, !tbaa !2 %sub = fsub fast float %0, %1 %add = fadd fast float %sum.0, %sub is transformed into %arrayidx = getelementptr inbounds float, float* %Vec0, i64 %idxprom %0 = load float, floa...
2019 Aug 08
2
Suboptimal code generated by clang+llc in quite a common scenario (?)
...: %0 = load i8*, i8** @scscx, align 8, !tbaa !11 store i8 %i, i8* %0, align 1, !tbaa !13 %1 = load i8*, i8** @scscx, align 8, !tbaa !11 %arrayidx1 = getelementptr inbounds i8, i8* %1, i64 1 store i8 %j, i8* %arrayidx1, align 1, !tbaa !13 %2 = load i8*, i8** @scscx, align 8, !tbaa !11 %arrayidx2 = getelementptr inbounds i8, i8* %2, i64 2 store i8 %k, i8* %arrayidx2, align 1, !tbaa !13 ret i32 0 } According to that, the variable ‘scscx’ is loaded three times despite it’s never modified. The resulting assembly code is this: .globl _tst _tst: .cfi_startproc pushl %ebp .cfi_def_cfa_o...
2014 Sep 29
2
[LLVMdev] Alias Analysis across functions
...00; ++i) { A[i] = B[i] = i; } return sum(A,B); } Arguments to opt: "-mem2reg -basicaa -scev-aa -print-alias-sets" Output: Function: func Alias Set Tracker: 2 alias sets for 2 pointer values. AliasSet[0x2bc88b0, 2] may alias, Mod/Ref Pointers: (i32* %A.arrayidx, 4), (i32* %B.arrayidx2, 4) 1 Unknown instructions: i32 %call AliasSet[0x2bc8490, 1] must alias, Mod forwarding to 0x2bc88b0 Function: sum Alias Set Tracker: 1 alias sets for 2 pointer values. AliasSet[0x2bcbb50, 2] may alias, Ref Pointers: (i32* %A.arrayidx, 4), (i32* %B.arrayidx2, 4) Thanks, Vina...
2018 Jun 11
4
One more No-alias case on Alias analysis
...idx]; char *b = &buf[idx]; *a = 1; *b = 2; } I can see below output from alias set tracker for above code snippet. Alias sets for function 'test': Alias Set Tracker: 1 alias sets for 2 pointer values.   AliasSet[0x53d8070, 2] may alias, Mod       Pointers: (i8* %arrayidx, 1), (i8* %arrayidx2, 1) As you can see on above code snippet, the 'a' and 'b' are not aliased. I think if we have following offset form, we can say No-alias between them. offset1 = odd_number - index offset2 = index I have implemented simple code for it and the output is as following: Alias sets...
2014 Feb 19
2
[LLVMdev] better code for IV
...ar, %L_entry ] %L_tid = phi i64 [ 0, %L_pre_head ], [ %L_inc_tid, %L_entry ] %trunc = trunc i64 %L_tid to i32 %idxprom = sext i32 %trunc to i64 %arrayidx = getelementptr inbounds float* %a, i64 %idxprom %0 = load float* %arrayidx, align 4 %arrayidx2 = getelementptr inbounds float* %b, i64 %idxprom %1 = load float* %arrayidx2, align 4 %add = fadd float %0, %1 %arrayidx4 = getelementptr inbounds float* %c, i64 %idxprom store float %add, float* %arrayidx4, align 4 %L_inc_ind_var = add nuw nsw i64...
2018 Nov 18
3
Dependence Analysis bug or undefined behavior?
...(TLDR: a store of i64 at offset n, followed by a load of i32 at offset n+1.) define void @foo(i32* %A, i64 %n) { entry: %arrayidx = getelementptr inbounds i32, i32* %A, i64 %n %arrayidx_cast = bitcast i32* %arrayidx to i64* store i64 0, i64* %arrayidx_cast, align 4 %add1 = add i64 %n, 1 %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %add1 %0 = load i32, i32* %arrayidx2, align 4 ret void } The result of Dependence Analysis is: opt -analyze -da BitCasts.ll Printing analysis 'Dependence Analysis' for function 'z0': da analyze - none! <<< this is be...
2013 Nov 11
2
[LLVMdev] What's the Alias Analysis does clang use ?
...sting to entry: %arrayidx = getelementptr inbounds float* %0, i64 1 LICM hoisting to entry: %3 = load float** %v1.addr, align 8 LICM hoisting to entry: %arrayidx1 = getelementptr inbounds float* %1, i64 1 LICM hoisting to entry: %5 = load float** %v2.addr, align 8 LICM hoisting to entry: %arrayidx2 = getelementptr inbounds float* %2, i64 1 LICM hoisting to entry: %12 = load float** %t.addr, align 8 Alias Set Tracker: 10 alias sets for 13 pointer values. AliasSet[0x1b7e800, 1] must alias, Mod/Ref Pointers: (float** %v0.addr, 8) AliasSet[0x1b7d7e0, 1] must alias, Mod/Ref Pointers: (fl...
2013 Feb 07
1
[LLVMdev] alloca scalarization with dynamic indexing into vectors
...ne { entry: %sPrivateStorage = alloca [3 x <2 x i32>], align 8 %0 = load <2 x i32>* %src, align 8, !tbaa !9 %arrayidx1 = getelementptr inbounds [3 x <2 x i32>]* %sPrivateStorage, i64 0, i64 0 store <2 x i32> %0, <2 x i32>* %arrayidx1, align 8, !tbaa !9 %arrayidx2 = getelementptr inbounds <2 x i32>* %src, i64 1 %1 = load <2 x i32>* %arrayidx2, align 8, !tbaa !9 %arrayidx3 = getelementptr inbounds [3 x <2 x i32>]* %sPrivateStorage, i64 0, i64 1 store <2 x i32> %1, <2 x i32>* %arrayidx3, align 8, !tbaa !9 %arrayidx4 =...
2018 Jun 13
2
Question about a May-alias case
...define void @test(i32 %idx) {   2 entry:   3   %sub = sub nsw i32 3, %idx   4   %idxprom = sext i32 %sub to i64   5   %arrayidx = getelementptr inbounds [4 x i8*], [4 x i8*]* @buf, i64 0, i64 %idxprom   6   %0 = load i8*, i8** %arrayidx, align 8   7   %idxprom1 = sext i32 %idx to i64   8   %arrayidx2 = getelementptr inbounds [4 x i8*], [4 x i8*]* @buf, i64 0, i64 %idxprom1   9   %1 = load i8*, i8** %arrayidx2, align 8  10   %2 = load i8, i8* %1, align 1  11   store i8 %2, i8* %0, align 1  12   %3 = load i8, i8* @c, align 1  13   %inc = add nsw i8 %3, 1  14   store i8 %inc, i8* @c, align...
2013 Nov 12
0
[LLVMdev] What's the Alias Analysis does clang use ?
...ayidx = getelementptr inbounds float* %0, > i64 1 > LICM hoisting to entry: %3 = load float** %v1.addr, align 8 > LICM hoisting to entry: %arrayidx1 = getelementptr inbounds float* > %1, i64 1 > LICM hoisting to entry: %5 = load float** %v2.addr, align 8 > LICM hoisting to entry: %arrayidx2 = getelementptr inbounds float* > %2, i64 1 > LICM hoisting to entry: %12 = load float** %t.addr, align 8 > Alias Set Tracker: 10 alias sets for 13 pointer values. > AliasSet[0x1b7e800, 1] must alias, Mod/Ref Pointers: (float** > %v0.addr, 8) > AliasSet[0x1b7d7e0, 1] must alias, M...
2012 Mar 08
2
[LLVMdev] -indvars issues?
...cmp slt i32 %0, 100 > br i1 %cmp, label %for.body, label %for.end > > for.body: ; preds = %for.cond > %arrayidx = getelementptr inbounds i32* %y, i64 %indvars.iv > %1 = load i32* %arrayidx, align 4 > %add = add nsw i32 %1, 3 > %arrayidx2 = getelementptr inbounds i32* %x, i64 %indvars.iv > store i32 %add, i32* %arrayidx2, align 4 > br label %for.inc > > for.inc: ; preds = %for.body > %indvars.iv.next = add i64 %indvars.iv, 2 > br label %for.cond > > for.end:...
2017 May 19
4
memcmp code fragment
...only %block, i16* nocapture readnone %quadrant, i32 %nblock, i32* nocapture readnone %budget) local_unnamed_addr #0 { entry: %idxprom = zext i32 %i1 to i64 %arrayidx = getelementptr inbounds i8, i8* %block, i64 %idxprom %0 = load i8, i8* %arrayidx, align 1 %idxprom1 = zext i32 %i2 to i64 %arrayidx2 = getelementptr inbounds i8, i8* %block, i64 %idxprom1 %1 = load i8, i8* %arrayidx2, align 1 %cmp = icmp eq i8 %0, %1 br i1 %cmp, label %if.end, label %if.then if.then: ; preds = %entry %cmp7 = icmp ugt i8 %0, %1 br label %return if.end:...
2013 Feb 05
3
[LLVMdev] Vectorizing global struct pointers
...--renato PS: A simplified version of the IR: %struct.anon = type { [256 x i64], [256 x i64], [256 x i64] } @Foo = common global %struct.anon zeroinitializer, align 8 ... %arrayidx = getelementptr inbounds %struct.anon* @Foo, i32 0, i32 1, i32 %idxprom %0 = load i64* %arrayidx, align 8 %arrayidx2 = getelementptr inbounds %struct.anon* @Foo, i32 0, i32 2, i32 %idxprom %1 = load i64* %arrayidx2, align 8 %mul = mul nsw i64 %1, %0 %arrayidx4 = getelementptr inbounds %struct.anon* @Foo, i32 0, i32 0, i32 %idxprom store i64 %mul, i64* %arrayidx4, align 8 -------------- next part ---------...
2018 Jun 12
2
One more No-alias case on Alias analysis
...>> I can see below output from alias set tracker for above code snippet. >> >> Alias sets for function 'test': >> Alias Set Tracker: 1 alias sets for 2 pointer values. >>   AliasSet[0x53d8070, 2] may alias, Mod       Pointers: (i8* >> %arrayidx, 1), (i8* %arrayidx2, 1) >> >> As you can see on above code snippet, the 'a' and 'b' are not >> aliased. I think if we have following offset form, we can say >> No-alias between them. >> >> offset1 = odd_number - index >> >> offset2 = index >> >&g...
2020 Jun 19
4
LLVM-IR store-load propagation
...= bitcast [2 x i64]* %Memory to i8* %arrayidx = getelementptr inbounds [2 x i64], [2 x i64]* %Memory, i64 0, i64 0 store i64 5369966919, i64* %arrayidx, align 16 %arrayidx1 = getelementptr inbounds [2 x i64], [2 x i64]* %Memory, i64 0, i64 1 store i64 5369966790, i64* %arrayidx1, align 8 %arrayidx2 = getelementptr inbounds [2 x i64], [2 x i64]* %Memory, i64 0, i64 %shr %1 = load i64, i64* %arrayidx2, align 8 ret i64 %1 } define i64 @_Z3tgtm(i64 %Flags) { entry: %0 = and i64 %Flags, 64 %trunc = icmp eq i64 %0, 0 %. = select i1 %trunc, i64 5369966919, i64 5369966790 ret i64 %. } A...
2015 Dec 09
2
Field sensitive alias analysis?
...#0 { entry: %idxprom = sext i32 %i to i64 %arrayidx = getelementptr inbounds %struct.S, %struct.S* %ps, i64 0, i32 0, i64 %idxprom store i32 1, i32* %arrayidx, align 4, !tbaa !1 %b = getelementptr inbounds %struct.S, %struct.S* %ps, i64 0, i32 1 store i32 2, i32* %b, align 4, !tbaa !5 %arrayidx2 = getelementptr inbounds %struct.S, %struct.S* %ps, i64 0, i32 0, i64 0 %0 = load i32, i32* %arrayidx2, align 4, !tbaa !1 ret i32 %0 } !1 = !{!2, !2, i64 0} !2 = !{!"int", !3, i64 0} !3 = !{!"omnipotent char", !4, i64 0} !4 = !{!"Simple C/C++ TBAA"} !5 = !{!6, !2,...
2016 Aug 17
2
Loop vectorization with the loop containing bitcast
...; preds = %for.body, %entry %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] %arrayidx = getelementptr inbounds [1000 x double], [1000 x double]* @c, i64 0, i64 %indvars.iv %0 = bitcast double* %arrayidx to i64* %1 = load i64, i64* %0, align 8, !tbaa !1 %arrayidx2 = getelementptr inbounds [1000 x double], [1000 x double]* @b, i64 0, i64 %indvars.iv %2 = bitcast double* %arrayidx2 to i64* store i64 %1, i64* %2, align 8, !tbaa !1 store double 0.000000e+00, double* %arrayidx, align 8, !tbaa !1 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcon...
2015 Dec 07
3
Field sensitive alias analysis?
...* %a, align 4, !tbaa !1 > %b = getelementptr inbounds %struct.S, %struct.S* %p, i64 0, i32 1 > store i32 2, i32* %b, align 4, !tbaa !6 > %arrayidx = getelementptr inbounds %struct.S, %struct.S* %p, i64 0, i32 > 2, i64 0 > store i32 3, i32* %arrayidx, align 4, !tbaa !7 > %arrayidx2 = getelementptr inbounds %struct.S, %struct.S* %p, i64 0, i32 > 2, i64 1 > store i32 4, i32* %arrayidx2, align 4, !tbaa !7 > ret void > } > > !0 = !{!"clang version 3.8.0 "} > !1 = !{!2, !3, i64 0} > !2 = !{!"S", !3, i64 0, !3, i64 4, !4, i64 8} >...
2013 Jan 21
2
[LLVMdev] introducing sign extending halfword loads into the LLVM IR
...tions. In the example, the sign extension gets combined with the 32-bit comparison implementing the val>-2048, resulting in a 16-bit comparison on the non-extended value; the result is a comparison operation on 16-bit operands, followed by a select operation on 32-bit operands: %0 = load i16* %arrayidx2, align 2, !dbg !502 %conv = sext i16 %0 to i32, !dbg !502 %cmp16 = icmp sgt i16 %0, 2047, !dbg !510 br i1 %cmp16, label %if.end23, label %if.else, !dbg !510 if.else: ; preds = %for.body %cmp19 = icmp slt i16 %0, -2048, !dbg !511...
2015 Dec 08
2
Field sensitive alias analysis?
...lementptr inbounds %struct.S, %struct.S* %p, i64 0, i32 1 >>> store i32 2, i32* %b, align 4, !tbaa !6 >>> %arrayidx = getelementptr inbounds %struct.S, %struct.S* %p, i64 0, >>> i32 2, i64 0 >>> store i32 3, i32* %arrayidx, align 4, !tbaa !7 >>> %arrayidx2 = getelementptr inbounds %struct.S, %struct.S* %p, i64 0, >>> i32 2, i64 1 >>> store i32 4, i32* %arrayidx2, align 4, !tbaa !7 >>> ret void >>> } >>> >>> !0 = !{!"clang version 3.8.0 "} >>> !1 = !{!2, !3, i64 0} >>&g...