[llvm] c4603a8 - [InstCombine][DebugInfo] Remove superflous assertion, add test

Peter Waller via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 18 04:00:34 PDT 2021


Author: Peter Waller
Date: 2021-10-18T11:00:01Z
New Revision: c4603a8a4384d36d23fd284689b453b9927541be

URL: https://github.com/llvm/llvm-project/commit/c4603a8a4384d36d23fd284689b453b9927541be
DIFF: https://github.com/llvm/llvm-project/commit/c4603a8a4384d36d23fd284689b453b9927541be.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/Local.cpp
    llvm/test/Transforms/InstCombine/debuginfo-scalable-typesize.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 122977c672df0..3e36f498523d6 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -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);
       }
     }

diff  --git a/llvm/test/Transforms/InstCombine/debuginfo-scalable-typesize.ll b/llvm/test/Transforms/InstCombine/debuginfo-scalable-typesize.ll
index 1156ae5d34eed..d986494ee501b 100644
--- a/llvm/test/Transforms/InstCombine/debuginfo-scalable-typesize.ll
+++ b/llvm/test/Transforms/InstCombine/debuginfo-scalable-typesize.ll
@@ -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/")


        


More information about the llvm-commits mailing list