File: 2015-09-18-Addrspace.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 (28 lines) | stat: -rw-r--r-- 1,188 bytes parent folder | download | duplicates (8)
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
; RUN: opt < %s -passes=simple-loop-unswitch -verify-memoryssa -S | FileCheck %s

; In cases where two address spaces do not have the same size pointer, the
; input for the addrspacecast should not be used as a substitute for itself
; when manipulating the pointer.

target datalayout = "e-m:e-p:16:16-p1:32:16-i32:16-i64:16-n8:16"

define void @foo() {
; CHECK-LABEL: @foo
entry:
  %arrayidx.i1 = getelementptr inbounds i16, ptr undef, i16 undef
  %arrayidx.i = addrspacecast ptr %arrayidx.i1 to ptr addrspace(1)
  br i1 undef, label %for.body.i, label %bar.exit

for.body.i:                                       ; preds = %for.body.i, %entry
; When we call makeLoopInvariant (i.e. trivial LICM) on this load, it
; will try to find the base object to prove deferenceability.  If we look
; through the addrspacecast, we'll fail an assertion about bitwidths matching
; CHECK-LABEL: for.body.i
; CHECK:   %0 = load i16, ptr addrspace(1) %arrayidx.i, align 2
  %0 = load i16, ptr addrspace(1) %arrayidx.i, align 2
  %cmp1.i = icmp eq i16 %0, 0
  br i1 %cmp1.i, label %bar.exit, label %for.body.i

bar.exit:                                         ; preds = %for.body.i, %entry
  ret void
}