1 ; RUN: not --crash opt -passes='consthoist' -S -o - -consthoist-gep=1 -mtriple=x86_64-unknown-linux-gnu < %s 2>&1 | FileCheck %s
5 ; My changes fixed this likely by accident, please update as necessary when
9 ; Matching assertion strings is not easy as they might differ on different
10 ; platforms. So limit this to x86_64-linux.
11 ; REQUIRES: x86_64-linux
13 ; This is a reproducer for https://github.com/llvm/llvm-project/issues/52689
15 ; opt: ../lib/Transforms/Scalar/ConstantHoisting.cpp:919: bool llvm::ConstantHoistingPass::emitBaseConstants(llvm::GlobalVariable *): Assertion `UsesNum == (ReBasesNum + NotRebasedNum) && "Not all uses are rebased"' failed.
17 ; CHECK: UsesNum == (ReBasesNum + NotRebasedNum)
18 ; CHECK-SAME: Not all uses are rebased
20 @g_77 = external global [5 x i32]
22 define internal ptr @func_29(i1 %p1, i1 %p2, ptr %p3) {
24 br i1 %p1, label %crit_edge, label %if.else3089
26 crit_edge: ; preds = %entry
27 br label %for.cond1063
29 for.cond1063: ; preds = %cleanup1660, %crit_edge
30 %l_323.sroa.0.0 = phi ptr [ getelementptr inbounds ([5 x i32], ptr @g_77, i32 0, i32 3), %cleanup1660 ], [ null, %crit_edge ]
31 %l_323.sroa.2.0 = phi ptr [ getelementptr inbounds ([5 x i32], ptr @g_77, i32 0, i32 3), %cleanup1660 ], [ null, %crit_edge ]
32 br i1 %p2, label %cleanup1660.thread, label %cleanup1674
34 cleanup1660.thread: ; preds = %for.cond1063
37 cleanup1660: ; No predecessors!
38 br label %for.cond1063
40 cleanup1674: ; preds = %cleanup1660.thread, %for.cond1063
41 store ptr getelementptr inbounds ([5 x i32], ptr @g_77, i32 0, i32 1), ptr %p3, align 1
44 if.else3089: ; preds = %entry
45 store ptr getelementptr inbounds ([5 x i32], ptr @g_77, i32 0, i32 1), ptr %p3, align 1