1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt -O0 -S < %s | FileCheck %s --check-prefix=O0
3 ; RUN: opt -O1 -S < %s | FileCheck %s
4 ; RUN: opt -O2 -S < %s | FileCheck %s
5 ; RUN: opt -O3 -S < %s | FileCheck %s
6 ; RUN: opt -Os -S < %s | FileCheck %s
7 ; RUN: opt -Oz -S < %s | FileCheck %s
9 target datalayout = "e-p:64:64"
11 ; Make sure that optimizations do not lose inrange information.
13 @vtable = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr null, ptr null] }
15 define void @foo(ptr %p) {
16 ; O0-LABEL: define void @foo(
17 ; O0-SAME: ptr [[P:%.*]]) {
18 ; O0-NEXT: store ptr getelementptr inrange(-24, 0) ({ [3 x ptr], [3 x ptr] }, ptr @vtable, i32 0, i32 0, i32 3), ptr [[P]], align 8
21 ; CHECK-LABEL: define void @foo(
22 ; CHECK-SAME: ptr nocapture writeonly initializes((0, 8)) [[P:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
23 ; CHECK-NEXT: store ptr getelementptr inbounds inrange(-24, 0) (i8, ptr @vtable, i64 24), ptr [[P]], align 8
24 ; CHECK-NEXT: ret void
26 store ptr getelementptr inrange(-24, 0) ({ [3 x ptr], [3 x ptr] }, ptr @vtable, i32 0, i32 0, i32 3), ptr %p