[llvm] r233562 - Verifier: Loosen r233559 check for 'function:' field in MDSubprogram

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Mar 30 10:45:09 PDT 2015


> On 2015-Mar-30, at 10:39, David Blaikie <dblaikie at gmail.com> wrote:
> 
> 
> 
> On Mon, Mar 30, 2015 at 10:04 AM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
> Author: dexonsmith
> Date: Mon Mar 30 12:04:06 2015
> New Revision: 233562
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=233562&view=rev
> Log:
> Verifier: Loosen r233559 check for 'function:' field in MDSubprogram
> 
> Stop worrying about what the `function:` field is in `MDSubprogram`,
> since it could be a bitcast [1].  Just check its type and leave it at
> that.
> 
> [1]: http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_build/3540/
> 
> Is this an acceptable thing? How does this arise? Could we have a small test case demonstrating it? (and/or demonstrating how it comes about?)

I think it's from function merging, so we needed bitcasts from one
function type to the other.

Once your opaque pointer type work is complete, those bitcasts won't
be necessary, so we can check that it's pointing at a `Function`.

Maybe I can use `stripPointerCasts()` to do that even now?

>  
> 
> 
> 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=233562&r1=233561&r2=233562&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/Verifier.cpp (original)
> +++ llvm/trunk/lib/IR/Verifier.cpp Mon Mar 30 12:04:06 2015
> @@ -846,9 +846,8 @@ void Verifier::visitMDSubprogram(const M
>      auto *FMD = dyn_cast<ConstantAsMetadata>(RawF);
>      auto *F = FMD ? FMD->getValue() : nullptr;
>      auto *FT = F ? dyn_cast<PointerType>(F->getType()) : nullptr;
> -    Assert(F && (isa<Function>(F) || isa<ConstantPointerNull>(F)) && FT &&
> -               isa<FunctionType>(FT->getElementType()),
> -           "invalid function", &N, F);
> +    Assert(F && FT && isa<FunctionType>(FT->getElementType()),
> +           "invalid function", &N, F, FT);
>    }
>    if (N.getRawTemplateParams()) {
>      auto *Params = dyn_cast<MDTuple>(N.getRawTemplateParams());
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 





More information about the llvm-commits mailing list