[llvm] r233468 - Verifier: Allow subroutine types to have no type array

David Blaikie dblaikie at gmail.com
Fri Mar 27 20:47:33 PDT 2015


On Fri, Mar 27, 2015 at 7:43 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

> Author: dexonsmith
> Date: Fri Mar 27 21:43:53 2015
> New Revision: 233468
>
> URL: http://llvm.org/viewvc/llvm-project?rev=233468&view=rev
> Log:
> Verifier: Allow subroutine types to have no type array
>
> Loosen one check from r233446: as long as `DIBuilder` requires a
> non-null type for every subprogram, we should allow a null type array.
> Also add tests for the rest of `MDSubroutineType`, which were somehow
> missing.
>

I'm guessing this sort of debug info (function with a subroutine with a
null type array) comes from clang in -gmlt mode? Should we just instead say
that the function has no type? what're tre tradeoffs?


>
> Added:
>     llvm/trunk/test/Assembler/mdsubroutinetype.ll
> Modified:
>     llvm/trunk/lib/IR/Verifier.cpp
>
> Modified: llvm/trunk/lib/IR/Verifier.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=233468&r1=233467&r2=233468&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/IR/Verifier.cpp (original)
> +++ llvm/trunk/lib/IR/Verifier.cpp Fri Mar 27 21:43:53 2015
> @@ -758,12 +758,11 @@ void Verifier::visitMDCompositeType(cons
>
>  void Verifier::visitMDSubroutineType(const MDSubroutineType &N) {
>    Assert(N.getTag() == dwarf::DW_TAG_subroutine_type, "invalid tag", &N);
> -  Assert(N.getRawElements() && isa<MDTuple>(N.getRawElements()),
> -         "invalid composite elements", &N, N.getRawElements());
> -
> -  for (Metadata *Ty : N.getTypeArray()->operands()) {
> -    Assert(isTypeRef(Ty), "invalid subroutine type ref", &N,
> N.getTypeArray(),
> -           Ty);
> +  if (auto *Types = N.getRawTypeArray()) {
> +    Assert(isa<MDTuple>(Types), "invalid composite elements", &N, Types);
> +    for (Metadata *Ty : N.getTypeArray()->operands()) {
> +      Assert(isTypeRef(Ty), "invalid subroutine type ref", &N, Types, Ty);
> +    }
>    }
>  }
>
>
> Added: llvm/trunk/test/Assembler/mdsubroutinetype.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/mdsubroutinetype.ll?rev=233468&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/Assembler/mdsubroutinetype.ll (added)
> +++ llvm/trunk/test/Assembler/mdsubroutinetype.ll Fri Mar 27 21:43:53 2015
> @@ -0,0 +1,23 @@
> +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
> +; RUN: verify-uselistorder %s
> +
> +; CHECK: !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8}
> +!named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8}
> +
> +!0 = !MDBasicType(name: "int", size: 32, align: 32, encoding:
> DW_ATE_signed)
> +!1 = !{null}
> +!2 = !{null, !0}
> +!3 = !{!0, !0, !0}
> +
> +
> +; CHECK: !4 = !MDSubroutineType(types: !1)
> +; CHECK: !5 = !MDSubroutineType(types: !2)
> +; CHECK: !6 = !MDSubroutineType(types: !3)
> +; CHECK: !7 = !MDSubroutineType(flags: DIFlagLValueReference, types: !3)
> +!4 = !MDSubroutineType(types: !1)
> +!5 = !MDSubroutineType(types: !2)
> +!6 = !MDSubroutineType(types: !3)
> +!7 = !MDSubroutineType(flags: DIFlagLValueReference, types: !3)
> +
> +; CHECK: !8 = !MDSubroutineType(types: null)
> +!8 = !MDSubroutineType(types: null)
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150327/451b6e40/attachment.html>


More information about the llvm-commits mailing list