File: cross_block_slp.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (63 lines) | stat: -rw-r--r-- 2,262 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=slp-vectorizer,dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"

; int foo(ptr A, ptr B, int g) {
;   float B0 = B[0];
;   float B1 = B[1]; <----- BasicBlock #1
;   B0 += 5;
;   B1 += 8;
;
;   if (g) bar();
;
;   A[0] += B0;     <------- BasicBlock #3
;   A[1] += B1;
; }


define i32 @foo(ptr nocapture %A, ptr nocapture %B, i32 %g) {
; CHECK-LABEL: @foo(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[TMP1:%.*]] = load <2 x float>, ptr [[B:%.*]], align 4
; CHECK-NEXT:    [[TMP2:%.*]] = fadd <2 x float> [[TMP1]], <float 5.000000e+00, float 8.000000e+00>
; CHECK-NEXT:    [[TOBOOL:%.*]] = icmp eq i32 [[G:%.*]], 0
; CHECK-NEXT:    br i1 [[TOBOOL]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
; CHECK:       if.then:
; CHECK-NEXT:    [[CALL:%.*]] = tail call i32 (...) @bar()
; CHECK-NEXT:    br label [[IF_END]]
; CHECK:       if.end:
; CHECK-NEXT:    [[TMP3:%.*]] = fpext <2 x float> [[TMP2]] to <2 x double>
; CHECK-NEXT:    [[TMP5:%.*]] = load <2 x double>, ptr [[A:%.*]], align 8
; CHECK-NEXT:    [[TMP6:%.*]] = fadd <2 x double> [[TMP3]], [[TMP5]]
; CHECK-NEXT:    store <2 x double> [[TMP6]], ptr [[A]], align 8
; CHECK-NEXT:    ret i32 undef
;
entry:
  %0 = load float, ptr %B, align 4
  %arrayidx1 = getelementptr inbounds float, ptr %B, i64 1
  %1 = load float, ptr %arrayidx1, align 4
  %add = fadd float %0, 5.000000e+00
  %add2 = fadd float %1, 8.000000e+00
  %tobool = icmp eq i32 %g, 0
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %call = tail call i32 (...) @bar()
  br label %if.end

if.end:
  %conv = fpext float %add to double
  %2 = load double, ptr %A, align 8
  %add4 = fadd double %conv, %2
  store double %add4, ptr %A, align 8
  %conv5 = fpext float %add2 to double
  %arrayidx6 = getelementptr inbounds double, ptr %A, i64 1
  %3 = load double, ptr %arrayidx6, align 8
  %add7 = fadd double %conv5, %3
  store double %add7, ptr %arrayidx6, align 8
  ret i32 undef
}

declare i32 @bar(...)