[AArch64][NFC] NFC for const vector as Instruction operand (#116790)
[llvm-project.git] / llvm / test / Transforms / InstCombine / enforce-known-alignment.ll
blobd9fd302b0722e463dab115aa14f8391fbebbec9f
1 ; RUN: opt -passes=instcombine -S %s | FileCheck %s
3 target datalayout = "e-p:32:32:32-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
4 target triple = "i386-apple-darwin9.6"
6 define void @foo(i32) {
7 ; CHECK-LABEL: @foo(
8 ; CHECK: alloca
9 ; CHECK: align 16
10         %2 = alloca [3 x <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>], align 16                ; <ptr> [#uses=1]
11         %3 = getelementptr [3 x <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>], ptr %2, i32 0, i32 0             ; <ptr> [#uses=1]
12         %4 = getelementptr <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>, ptr %3, i32 0, i32 0           ; <ptr> [#uses=1]
13         %5 = getelementptr { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } }, ptr %4, i32 0, i32 0         ; <ptr> [#uses=1]
14         %6 = getelementptr { [8 x i16] }, ptr %5, i32 0, i32 0          ; <ptr> [#uses=1]
15         %7 = getelementptr [8 x i16], ptr %6, i32 0, i32 0              ; <ptr> [#uses=1]
16         store i16 0, ptr %7, align 16
17     call void @bar(ptr %7)
18         ret void
21 declare void @bar(ptr)
23 define void @foo_as1(i32 %a, ptr addrspace(1) %b) {
24 ; CHECK-LABEL: @foo_as1(
25 ; CHECK: align 16
26   %1 = getelementptr [3 x <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>], ptr addrspace(1) %b, i32 0, i32 0        ; <ptr> [#uses=1]
27   %2 = getelementptr <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>, ptr addrspace(1) %1, i32 0, i32 0      ; <ptr> [#uses=1]
28   %3 = getelementptr { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } }, ptr addrspace(1) %2, i32 0, i32 0        ; <ptr> [#uses=1]
29   %4 = getelementptr { [8 x i16] }, ptr addrspace(1) %3, i32 0, i32 0     ; <ptr> [#uses=1]
30   %5 = getelementptr [8 x i16], ptr addrspace(1) %4, i32 0, i32 0     ; <ptr> [#uses=1]
31   store i16 0, ptr addrspace(1) %5, align 16
32   call void @bar_as1(ptr addrspace(1) %5)
33   ret void
36 declare void @bar_as1(ptr addrspace(1))