[InstCombine][DebugInfo] Remove superflous assertion, add test

When this code was added, an unnecessary assertion slipped in which we
now hit in real code.

Add a test to defend against it firing again.
This commit is contained in:
Peter Waller 2021-10-13 15:13:56 +00:00
parent d55db4b033
commit c4603a8a43
2 changed files with 9 additions and 2 deletions

View File

@ -1413,8 +1413,6 @@ static bool valueCoversEntireFragment(Type *ValTy, DbgVariableIntrinsic *DII) {
if (auto *AI =
dyn_cast_or_null<AllocaInst>(DII->getVariableLocationOp(0))) {
if (Optional<TypeSize> FragmentSize = AI->getAllocationSizeInBits(DL)) {
assert(ValueSize.isScalable() == FragmentSize->isScalable() &&
"Both sizes should agree on the scalable flag.");
return TypeSize::isKnownGE(ValueSize, *FragmentSize);
}
}

View File

@ -16,9 +16,18 @@ define <vscale x 2 x double> @debug_local_scalable(<vscale x 2 x double> %tostor
declare <vscale x 2 x double> @f(<vscale x 2 x double>*)
define float @debug_scalablevec_bitcast_to_scalar() {
%v.addr = alloca <vscale x 4 x float>, align 16
call void @llvm.dbg.declare(metadata <vscale x 4 x float>* %v.addr, metadata !3, metadata !DIExpression()), !dbg !5
%a = bitcast <vscale x 4 x float>* %v.addr to float*
%b = load float, float* %a, align 16
ret float undef
}
declare void @llvm.dbg.declare(metadata, metadata, metadata)
!llvm.module.flags = !{!2}
!llvm.dbg.cu = !{!0}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1)
!1 = !DIFile(filename: "/tmp/test.c", directory: "/tmp/")