Home | History | Annotate | Download | only in Inline
      1 ; RUN: opt -S -inline < %s | FileCheck %s
      2 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
      3 target triple = "x86_64-unknown-linux-gnu"
      4 
      5 ; Function Attrs: norecurse nounwind uwtable
      6 define void @Body(i32* nocapture %res, i32* nocapture readnone %c, i32* nocapture readonly %d, i32* nocapture readonly %p, i32 %i) #0 {
      7 entry:
      8   %idxprom = sext i32 %i to i64
      9   %arrayidx = getelementptr inbounds i32, i32* %p, i64 %idxprom
     10   %0 = load i32, i32* %arrayidx, align 4
     11   %cmp = icmp eq i32 %0, 0
     12   %arrayidx2 = getelementptr inbounds i32, i32* %res, i64 %idxprom
     13   %1 = load i32, i32* %arrayidx2, align 4
     14   br i1 %cmp, label %cond.end, label %cond.false
     15 
     16 cond.false:                                       ; preds = %entry
     17   %arrayidx6 = getelementptr inbounds i32, i32* %d, i64 %idxprom
     18   %2 = load i32, i32* %arrayidx6, align 4
     19   %add = add nsw i32 %2, %1
     20   br label %cond.end
     21 
     22 cond.end:                                         ; preds = %entry, %cond.false
     23   %cond = phi i32 [ %add, %cond.false ], [ %1, %entry ]
     24   store i32 %cond, i32* %arrayidx2, align 4
     25   ret void
     26 }
     27 
     28 ; Function Attrs: nounwind uwtable
     29 define void @Test(i32* %res, i32* %c, i32* %d, i32* %p, i32 %n) #1 {
     30 entry:
     31   br label %for.cond
     32 
     33 for.cond:                                         ; preds = %for.body, %entry
     34   %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
     35   %cmp = icmp slt i32 %i.0, 1600
     36   br i1 %cmp, label %for.body, label %for.end
     37 
     38 for.body:                                         ; preds = %for.cond
     39   call void @Body(i32* %res, i32* undef, i32* %d, i32* %p, i32 %i.0), !llvm.mem.parallel_loop_access !0
     40   %inc = add nsw i32 %i.0, 1
     41   br label %for.cond, !llvm.loop !0
     42 
     43 for.end:                                          ; preds = %for.cond
     44   ret void
     45 }
     46 
     47 ; CHECK-LABEL: @Test
     48 ; CHECK: load i32,{{.*}}, !llvm.mem.parallel_loop_access !0
     49 ; CHECK: load i32,{{.*}}, !llvm.mem.parallel_loop_access !0
     50 ; CHECK: load i32,{{.*}}, !llvm.mem.parallel_loop_access !0
     51 ; CHECK: store i32{{.*}}, !llvm.mem.parallel_loop_access !0
     52 ; CHECK: br label %for.cond, !llvm.loop !0
     53 
     54 attributes #0 = { norecurse nounwind uwtable }
     55 
     56 !0 = distinct !{!0}
     57 
     58