50 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes=consthoist -consthoist-gep=1 -S | FileCheck %s3 4; This is a reproducer for PR43903 where we hit an assertion:5; opt: ../lib/Transforms/Scalar/ConstantHoisting.cpp:903: bool llvm::ConstantHoistingPass::emitBaseConstants(llvm::GlobalVariable *): Assertion `UsesNum == (ReBasesNum + NotRebasedNum) && "Not all uses are rebased"' failed.6 7target triple = "x86_64-unknown-linux-gnu"8 9@a = external global [2 x i16], align 110 11define void @c(i1 %arg) {12; CHECK-LABEL: @c(13; CHECK-NEXT: for.cond:14; CHECK-NEXT: br i1 %arg, label [[FOR_BODY2:%.*]], label [[FOR_END4:%.*]]15; CHECK: for.body2:16; CHECK-NEXT: br i1 %arg, label [[LAND_RHS:%.*]], label [[LAND_END:%.*]]17; CHECK: land.rhs:18; CHECK-NEXT: unreachable19; CHECK: land.end:20; CHECK-NEXT: [[CMP:%.*]] = icmp ule ptr undef, @a21; CHECK-NEXT: unreachable22; CHECK: for.cond3:23; CHECK-NEXT: [[TMP0:%.*]] = load i16, ptr getelementptr inbounds ([2 x i16], ptr @a, i32 0, i32 1), align 124; CHECK-NEXT: br label [[FOR_COND3:%.*]]25; CHECK: for.end4:26; CHECK-NEXT: [[TMP1:%.*]] = load i16, ptr @a, align 127; CHECK-NEXT: ret void28;29for.cond:30 br i1 %arg, label %for.body2, label %for.end431 32for.body2: ; preds = %for.cond33 br i1 %arg, label %land.rhs, label %land.end34 35land.rhs: ; preds = %for.body236 unreachable37 38land.end: ; preds = %for.body239 %cmp = icmp ule ptr undef, @a40 unreachable41 42for.cond3: ; preds = %for.cond343 %tmp0 = load i16, ptr getelementptr inbounds ([2 x i16], ptr @a, i32 0, i32 1), align 144 br label %for.cond345 46for.end4: ; preds = %for.cond47 %tmp1 = load i16, ptr @a, align 148 ret void49}50