File: branch-non-mbb.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (46 lines) | stat: -rw-r--r-- 1,579 bytes parent folder | download | duplicates (18)
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
; RUN: llc -march=hexagon < %s
; REQUIRES: asserts
;
; The tail calls to foo and bar are branches with functions as operands,
; instead of basic blocks. Make sure we don't crash on such instructions.

target datalayout = "e-m:e-p:32:32:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f64:64:64-f32:32:32-v64:64:64-v32:32:32-a:0-n16:32"
target triple = "hexagon"

%struct.t0 = type { i8, [2 x i8] }
%struct.t1 = type { i8, i8, [1900 x i8], %struct.t0 }

@var = internal global [3 x %struct.t1] zeroinitializer, align 8
declare void @foo() #2
declare void @bar(i32, i32) #2

; Function Attrs: nounwind
define void @fred(i8 signext %a, i8 signext %b) #1 {
entry:
  %i = sext i8 %a to i32
  %t = getelementptr inbounds [3 x %struct.t1], [3 x %struct.t1]* @var, i32 0, i32 %i, i32 3, i32 0
  %0 = load i8, i8* %t, align 8
  switch i8 %0, label %if.end14 [
    i8 1, label %if.then
    i8 0, label %do.body
  ]

if.then:                                          ; preds = %entry
  %j = sext i8 %b to i32
  %u = getelementptr inbounds [3 x %struct.t1], [3 x %struct.t1]* @var, i32 0, i32 %i, i32 3, i32 1, i32 %j
  store i8 1, i8* %u, align 1
  tail call void @foo() #0
  br label %if.end14

do.body:                                          ; preds = %entry
  %conv11 = sext i8 %b to i32
  tail call void @bar(i32 %i, i32 %conv11) #0
  br label %if.end14

if.end14:                                         ; preds = %entry, %do.body, %if.then
  ret void
}

attributes #0 = { nounwind }
attributes #1 = { nounwind "disable-tail-calls"="false" }
attributes #2 = { "disable-tail-calls"="false" }