aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/FileCheck.cpp
diff options
context:
space:
mode:
authorShoaib Meenai <smeenai@fb.com>2019-05-23 16:29:09 +0000
committerShoaib Meenai <smeenai@fb.com>2019-05-23 16:29:09 +0000
commit87226a720293281f49a312fe8342d1fdd0aa38ca (patch)
tree54d14c69e85a43958bf0f984f63bc81c33a44329 /llvm/lib/Support/FileCheck.cpp
parent000228183bf17a0f64afccdda35867553c9b75f6 (diff)
downloadllvm-87226a720293281f49a312fe8342d1fdd0aa38ca.zip
llvm-87226a720293281f49a312fe8342d1fdd0aa38ca.tar.gz
llvm-87226a720293281f49a312fe8342d1fdd0aa38ca.tar.bz2
[AsmPrinter] Treat a narrowing PtrToInt like Trunc
When printing assembly for PtrToInt, AsmPrinter::lowerConstant incorrectly assumed that if PtrToInt was not converting to an int with exactly the same number of bits, it must be widening to a larger int. But this isn't necessarily true; PtrToInt can also shrink the size, which is useful when you want to produce a known 32-bit pointer on a 64-bit platform (on x86_64 ELF this yields a R_X86_64_32 relocation). The old behavior of falling through to the widening case for a narrowing PtrToInt yields bogus assembly code like this, which fails to assemble because the no-op bit and it accidentally creates is not a valid relocation: ``` .long a&-1 ``` The fix is to treat a narrowing PtrToInt exactly the same as it already treats Trunc: just emit the expression and let the assembler deal with truncating it in the appropriate way. Patch by Mat Hostetter <mjh@fb.com>. Differential Revision: https://reviews.llvm.org/D61325 llvm-svn: 361508
Diffstat (limited to 'llvm/lib/Support/FileCheck.cpp')
0 files changed, 0 insertions, 0 deletions