OSDN Git Service

LLParser: add an argument for overriding data layout and do not check alloca addr...
authorYaxun Liu <Yaxun.Liu@amd.com>
Tue, 30 Jan 2018 22:32:39 +0000 (22:32 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Tue, 30 Jan 2018 22:32:39 +0000 (22:32 +0000)
commit7c2d049c5b324e9af37f1c4f42118de8fc4c638b
treee45dd0cbf65ff03ac7af32db699ffc87fdd22ca1
parentdb459e238aedcafdcca5746c0ba11a515eb333dd
LLParser: add an argument for overriding data layout and do not check alloca addr space

Sometimes users do not specify data layout in LLVM assembly and let llc set the
data layout by target triple after loading the LLVM assembly.

Currently the parser checks alloca address space no matter whether the LLVM
assembly contains data layout definition, which causes false alarm since the
default data layout does not contain the correct alloca address space.

The parser also calls verifier to check debug info and updating invalid debug
info. Currently there is no way to let the verifier to check debug info only.
If the verifier finds non-debug-info issues the parser will fail.

For llc, the fix is to remove the check of alloca addr space in the parser and
disable updating debug info, and defer the updating of debug info and
verification to be after setting data layout of the IR by target.

For other llvm tools, since they do not override data layout by target but
instead can override data layout by a command line option, an argument for
overriding data layout is added to the parser. In cases where data layout
overriding is necessary for the parser, the data layout can be provided by
command line.

Differential Revision: https://reviews.llvm.org/D41832

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323826 91177308-0d34-0410-b5e6-96231b3b80d8
18 files changed:
include/llvm/AsmParser/Parser.h
include/llvm/IRReader/IRReader.h
lib/AsmParser/LLParser.cpp
lib/AsmParser/LLParser.h
lib/AsmParser/Parser.cpp
lib/CodeGen/MIRParser/MIRParser.cpp
lib/IRReader/IRReader.cpp
test/Assembler/datalayout-alloca-addrspace-mismatch-0.ll
test/Assembler/datalayout-alloca-addrspace-mismatch-1.ll
test/Assembler/datalayout-alloca-addrspace-mismatch-2.ll
test/Assembler/drop-debug-info-nonzero-alloca.ll [new file with mode: 0644]
test/CodeGen/AMDGPU/alloca.ll [new file with mode: 0644]
test/CodeGen/AMDGPU/fence-barrier.ll
test/CodeGen/AMDGPU/invalid-alloca.ll [new file with mode: 0644]
test/CodeGen/AMDGPU/sched-crash-dbg-value.mir
tools/llc/llc.cpp
tools/llvm-as/llvm-as.cpp
tools/opt/opt.cpp