[PATCH] D41832: LLParser: do not verify LLVM module

Yaxun Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 26 10:14:46 PST 2018


yaxunl added a comment.

In https://reviews.llvm.org/D41832#989179, @aprantl wrote:

> You are right. My mental model of how this works was a bit out of date. We separated verification and debug info stripping recently. Let's scrap that idea.
>
> Let's go back to your previous statement:
>
> > If target is not specified on llc command line, llc needs to parse the LLVM assembly to get the target. To parse the LLVM assembly, llc needs to pass the datalayout to LLParser first. However, it does not know the datalayout since it does not know the target.
>
> Can you elaborate this? The problem is when only a datalayout but no target is specified on the commandline? Could you pass the datalayout as a string and have LLParser parse it?


llc is different from opt or llvm-as beause llc always override the datalayout of the input module with the datalayout of the target. Because llc always creates TargetMachine, it knows the datalayout string by target. Therefore llc is not supposed to get datalayout string by command line option. Instead, it is supposed to get datalayout string by target.

If the user does not specify target on llc command line, llc is supposed to get the target from LLVM assembly, then use it to get the datalayout string through TargetMachine. However, that means it has to parse the LLVM assembly first, but it cannot. Because to parse the LLVM assembly it needs to know the datalayout string first.

Of course, if we specify datalayout string by a command line option we can bypass this issue. If this does not sounds like a redundant option.


https://reviews.llvm.org/D41832





More information about the llvm-commits mailing list