Home | History | Annotate | Download | only in X86
      1 ; RUN: llvm-as < %s >%t.bc
      2 ; PR21108: Diagnostic handlers get pass remarks, even if they're not enabled.
      3 
      4 ; Confirm that there are -pass-remarks.
      5 ; RUN: llvm-lto -pass-remarks=inline \
      6 ; RUN:          -exported-symbol _func2 -pass-remarks-analysis=loop-vectorize \
      7 ; RUN:          -exported-symbol _main -o %t.o %t.bc 2>&1 | \
      8 ; RUN:     FileCheck %s -allow-empty -check-prefix=REMARKS
      9 ; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
     10 
     11 ; RUN: llvm-lto -pass-remarks=inline -use-diagnostic-handler \
     12 ; RUN:          -exported-symbol _func2 -pass-remarks-analysis=loop-vectorize \
     13 ; RUN:         -exported-symbol _main -o %t.o %t.bc 2>&1 | \
     14 ; RUN:     FileCheck %s -allow-empty -check-prefix=REMARKS_DH
     15 ; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
     16 
     17 ; Confirm that -pass-remarks are not printed by default.
     18 ; RUN: llvm-lto \
     19 ; RUN:         -exported-symbol _func2 \
     20 ; RUN:         -exported-symbol _main -o %t.o %t.bc 2>&1 | \
     21 ; RUN:     FileCheck %s -allow-empty
     22 ; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
     23 
     24 ; RUN: llvm-lto -use-diagnostic-handler \
     25 ; RUN:         -exported-symbol _func2 \
     26 ; RUN:         -exported-symbol _main -o %t.o %t.bc 2>&1 | \
     27 ; RUN:     FileCheck %s -allow-empty
     28 ; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
     29 
     30 ; REMARKS: remark: {{.*}} foo inlined into main
     31 ; REMARKS: remark: {{.*}} loop not vectorized: cannot prove it is safe to reorder memory operations
     32 ; REMARKS_DH: llvm-lto: remark: {{.*}} foo inlined into main
     33 ; REMARKS_DH: llvm-lto: remark: {{.*}} loop not vectorized: cannot prove it is safe to reorder memory operations
     34 ; CHECK-NOT: remark:
     35 ; CHECK-NOT: llvm-lto:
     36 ; NM-NOT: foo
     37 ; NM: func2
     38 ; NM: main
     39 
     40 target triple = "x86_64-apple-darwin"
     41 
     42 declare i32 @bar()
     43 
     44 define i32 @foo() {
     45   %a = call i32 @bar()
     46   ret i32 %a
     47 }
     48 
     49 define i32 @main() {
     50   %i = call i32 @foo()
     51   ret i32 %i
     52 }
     53 
     54 define i32 @func2(i32* %out, i32* %out2, i32* %A, i32* %B, i32* %C, i32* %D, i32* %E, i32* %F) {
     55 entry:
     56   br label %for.body
     57 
     58 for.body:                                         ; preds = %for.body, %entry
     59   %i.037 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
     60   %arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.037
     61   %0 = load i32, i32* %arrayidx, align 4
     62   %arrayidx1 = getelementptr inbounds i32, i32* %B, i64 %i.037
     63   %1 = load i32, i32* %arrayidx1, align 4
     64   %add = add nsw i32 %1, %0
     65   %arrayidx2 = getelementptr inbounds i32, i32* %C, i64 %i.037
     66   %2 = load i32, i32* %arrayidx2, align 4
     67   %add3 = add nsw i32 %add, %2
     68   %arrayidx4 = getelementptr inbounds i32, i32* %E, i64 %i.037
     69   %3 = load i32, i32* %arrayidx4, align 4
     70   %add5 = add nsw i32 %add3, %3
     71   %arrayidx6 = getelementptr inbounds i32, i32* %F, i64 %i.037
     72   %4 = load i32, i32* %arrayidx6, align 4
     73   %add7 = add nsw i32 %add5, %4
     74   %arrayidx8 = getelementptr inbounds i32, i32* %out, i64 %i.037
     75   store i32 %add7, i32* %arrayidx8, align 4
     76   %5 = load i32, i32* %arrayidx, align 4
     77   %6 = load i32, i32* %arrayidx1, align 4
     78   %add11 = add nsw i32 %6, %5
     79   %7 = load i32, i32* %arrayidx2, align 4
     80   %add13 = add nsw i32 %add11, %7
     81   %8 = load i32, i32* %arrayidx4, align 4
     82   %add15 = add nsw i32 %add13, %8
     83   %9 = load i32, i32* %arrayidx6, align 4
     84   %add17 = add nsw i32 %add15, %9
     85   %arrayidx18 = getelementptr inbounds i32, i32* %out2, i64 %i.037
     86   store i32 %add17, i32* %arrayidx18, align 4
     87   %inc = add i64 %i.037, 1
     88   %exitcond = icmp eq i64 %inc, 256
     89   br i1 %exitcond, label %for.end, label %for.body
     90 
     91 for.end:                                          ; preds = %for.body
     92   ret i32 undef
     93 }
     94