xref: /llvm-project/llvm/test/Transforms/AlignmentFromAssumptions/domtree-crash.ll (revision 5ce47a5813506e08daddc1e3d59b06f7a452c300)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2; RUN: opt -passes=alignment-from-assumptions -S < %s | FileCheck %s
3
4; The alignment assumption is a global, which has users in a different
5; function. Test that in this case the dominator tree is only queried with
6; blocks from the same function.
7
8@global = external constant [192 x i8]
9
10define void @fn1() {
11; CHECK-LABEL: define void @fn1() {
12; CHECK-NEXT:    call void @llvm.assume(i1 false) [ "align"(ptr @global, i64 1) ]
13; CHECK-NEXT:    ret void
14;
15  call void @llvm.assume(i1 false) [ "align"(ptr @global, i64 1) ]
16  ret void
17}
18
19define void @fn2() {
20; CHECK-LABEL: define void @fn2() {
21; CHECK-NEXT:    ret void
22; CHECK:       [[LOOP:.*]]:
23; CHECK-NEXT:    [[GEP:%.*]] = getelementptr inbounds i8, ptr @global, i64 0
24; CHECK-NEXT:    [[LOAD:%.*]] = load i64, ptr [[GEP]], align 1
25; CHECK-NEXT:    br label %[[LOOP]]
26;
27  ret void
28
29loop:
30  %gep = getelementptr inbounds i8, ptr @global, i64 0
31  %load = load i64, ptr %gep, align 1
32  br label %loop
33}
34