• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -mtriple aarch64-- -consthoist -S | FileCheck %s
3
4; This used to trigger an assertion failure:
5;
6;    ../lib/Transforms/Scalar/ConstantHoisting.cpp:779: void llvm::ConstantHoistingPass::emitBaseConstants(llvm::Instruction *, llvm::Constant *, llvm::Type *, const llvm::consthoist::ConstantUser &): Assertion `CastInst->isCast() && "Expected an cast instruction!"' failed.
7
8@c.a = external global i32, align 1
9
10define void @c() {
11; CHECK-LABEL: @c(
12; CHECK-NEXT:  entry:
13; CHECK-NEXT:    [[TOBOOL:%.*]] = icmp ne i16 0, 0
14; CHECK-NEXT:    br i1 undef, label [[LBL1_US:%.*]], label [[ENTRY_ENTRY_SPLIT_CRIT_EDGE:%.*]]
15; CHECK:       entry.entry.split_crit_edge:
16; CHECK-NEXT:    [[CONST:%.*]] = bitcast i32 1232131 to i32
17; CHECK-NEXT:    br label [[LBL1:%.*]]
18; CHECK:       lbl1.us:
19; CHECK-NEXT:    [[CONST1:%.*]] = bitcast i32 1232131 to i32
20; CHECK-NEXT:    store i32 [[CONST1]], i32* @c.a, align 1
21; CHECK-NEXT:    br label [[FOR_COND4:%.*]]
22; CHECK:       lbl1:
23; CHECK-NEXT:    store i32 [[CONST]], i32* @c.a, align 1
24; CHECK-NEXT:    br i1 undef, label [[IF_THEN:%.*]], label [[FOR_END12:%.*]]
25; CHECK:       if.then:
26; CHECK-NEXT:    br i1 undef, label [[LBL1]], label [[FOR_COND4]]
27; CHECK:       for.cond4:
28; CHECK-NEXT:    br label [[FOR_COND4]]
29; CHECK:       for.body9:
30; CHECK-NEXT:    store i32 1232131, i32* undef, align 1
31; CHECK-NEXT:    store i32 1232132, i32* undef, align 1
32; CHECK-NEXT:    br label [[FOR_BODY9:%.*]]
33; CHECK:       for.end12:
34; CHECK-NEXT:    ret void
35;
36entry:
37  %tobool = icmp ne i16 0, 0
38  br i1 undef, label %lbl1.us, label %entry.entry.split_crit_edge
39
40entry.entry.split_crit_edge:                      ; preds = %entry
41  br label %lbl1
42
43lbl1.us:                                          ; preds = %entry
44  store i32 1232131, i32* @c.a, align 1
45  br label %for.cond4
46
47lbl1:                                             ; preds = %if.then, %entry.entry.split_crit_edge
48  store i32 1232131, i32* @c.a, align 1
49  br i1 undef, label %if.then, label %for.end12
50
51if.then:                                          ; preds = %lbl1
52  br i1 undef, label %lbl1, label %for.cond4
53
54for.cond4:                                        ; preds = %for.cond4, %if.then, %lbl1.us
55  br label %for.cond4
56
57for.body9:                                        ; preds = %for.body9
58  store i32 1232131, i32* undef, align 1
59  store i32 1232132, i32* undef, align 1
60  br label %for.body9
61
62for.end12:                                        ; preds = %lbl1
63  ret void
64}
65