File: const-hoist-gep.ll

package info (click to toggle)
swiftlang 6.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,604 kB
  • sloc: cpp: 9,901,740; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (42 lines) | stat: -rw-r--r-- 2,342 bytes parent folder | download | duplicates (9)
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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt -passes=consthoist -consthoist-gep -S -o - %s | FileCheck %s

target triple = "aarch64"

%0 = type { %1, %2, [9 x i16], %6, %7 }
%1 = type { i32, i32, i32, i32, i32, i32, i16, i16, i8, i8, i16, i32, i32, i16, i8, i8 }
%2 = type { i32, %3, i8, i8, i8, i8, i32, %4, %5, [16 x i8], i16, i16, i8, i8, i8, i8, i32, i32, i32 }
%3 = type { i16, i8, i8 }
%4 = type { i16, i8, i8 }
%5 = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }
%6 = type { i8, i8 }
%7 = type { [5 x i32], [3 x i32], [6 x i32], [3 x i32], [2 x i32], [4 x i32], [3 x i32], [2 x i32], [4 x i32], [5 x i32], [3 x i32], [6 x i32], [1 x i32], i32, i32, i32, i32, i32, i32 }

@global = external dso_local local_unnamed_addr global %0, align 4

; Check that constant GEP expressions are rewritten to one-dimensional
; (single-index) GEPs, whose base poiner is a multi-dimensional GEP.
define dso_local void @zot() {
; CHECK-LABEL: define dso_local void @zot() {
; CHECK-NEXT:  bb:
; CHECK-NEXT:    [[CONST:%.*]] = bitcast ptr getelementptr inbounds ([[TMP0:%.*]], ptr @global, i32 0, i32 4, i32 0, i32 0) to ptr
; CHECK-NEXT:    store i32 undef, ptr [[CONST]], align 4
; CHECK-NEXT:    [[MAT_GEP:%.*]] = getelementptr i8, ptr [[CONST]], i32 4
; CHECK-NEXT:    [[MAT_BITCAST:%.*]] = bitcast ptr [[MAT_GEP]] to ptr
; CHECK-NEXT:    store i32 undef, ptr [[MAT_BITCAST]], align 4
; CHECK-NEXT:    [[MAT_GEP1:%.*]] = getelementptr i8, ptr [[CONST]], i32 160
; CHECK-NEXT:    [[MAT_BITCAST2:%.*]] = bitcast ptr [[MAT_GEP1]] to ptr
; CHECK-NEXT:    store i32 undef, ptr [[MAT_BITCAST2]], align 4
; CHECK-NEXT:    [[MAT_GEP3:%.*]] = getelementptr i8, ptr [[CONST]], i32 164
; CHECK-NEXT:    [[MAT_BITCAST4:%.*]] = bitcast ptr [[MAT_GEP3]] to ptr
; CHECK-NEXT:    store i32 undef, ptr [[MAT_BITCAST4]], align 4
; CHECK-NEXT:    ret void
;
bb:
  store i32 undef, ptr getelementptr inbounds (%0, ptr @global, i32 0, i32 4, i32 0, i32 0), align 4
  store i32 undef, ptr getelementptr inbounds (%0, ptr @global, i32 0, i32 4, i32 0, i32 1), align 4
  store i32 undef, ptr getelementptr inbounds (%0, ptr @global, i32 0, i32 4, i32 11, i32 0), align 4
  store i32 undef, ptr getelementptr inbounds (%0, ptr @global, i32 0, i32 4, i32 11, i32 1), align 4
  ret void
}