summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix dumping of characters with non-standard sizesPetr Pavlu2017-10-114-93/+176
| | | | | | | | | | | | | | | | * Prevent dumping of characters in DumpDataExtractor() with item_byte_size bigger than 8 bytes. This case is not supported by the code and results in a crash because the code calls DataExtractor::GetMaxU64Bitfield() -> GetMaxU64() that asserts for byte size > 8 bytes. * Teach DataExtractor::GetMaxU64(), GetMaxU32(), GetMaxS64() and GetMaxU64_unchecked() how to handle byte sizes that are not a multiple of 2. This allows DumpDataExtractor() to dump characters and booleans with item_byte_size in the interval of [1, 8] bytes. Values that are not a multiple of 2 would previously result in a crash because they were not handled by GetMaxU64(). llvm-svn: 315444
* [X86] Added tests for TESTM and TESTNM (NFC)Uriel Korach2017-10-114-0/+1148
| | | | | | | | Adding this test files now so after another commit that will add a new pattern for TESTM and TESTNM instructions will show the improvemnts that have been done. Change-Id: If3908b7f91897d764053312365a2bc1de78b291d llvm-svn: 315443
* [ELF] - Fix out of sync comment. NFC.George Rimar2017-10-111-1/+1
| | | | llvm-svn: 315442
* [ELF] - Do not set output section flags except SHF_{ALLOC,WRITE,EXECINSTR}.George Rimar2017-10-113-4/+59
| | | | | | | | | | | | | | | | | | | | | | | This is PR34546. Currently LLD creates output sections even if it has no input sections, but its command contains an assignment. Committed code just assigns the same flag that was used in previous live section. That does not work sometimes. For example if we have following script: .ARM.exidx : { *(.ARM.exidx*) } .foo : { _foo = 0; } } Then first section has SHF_LINK_ORDER flag. But section foo should not. That was a reason of crash in OutputSection::finalize(). LLD tried to calculate Link value, calling front() on empty input sections list. We should only keep access flags and omit all others when creating such sections. Patch fixes the crash observed. Differential revision: https://reviews.llvm.org/D37736 llvm-svn: 315441
* [GVN] Prevent LoadPRE from hoisting across instructions that don't pass ↵Max Kazantsev2017-10-114-0/+258
| | | | | | | | | | | | | | | | | | control flow to successors This patch fixes the miscompile that happens when PRE hoists loads across guards and other instructions that don't always pass control flow to their successors. PRE is now prohibited to hoist across such instructions because there is no guarantee that the load standing after such instruction is still valid before such instruction. For example, a load from under a guard may be invalid before the guard in the following case: int array[LEN]; ... guard(0 <= index && index < LEN); use(array[index]); Differential Revision: https://reviews.llvm.org/D37460 llvm-svn: 315440
* Revert r314955: "Remove PendingBody mechanism for function and ObjC method ↵Daniel Jasper2017-10-115-122/+79
| | | | | | | | | | | deserialization." This is breaking a build of https://github.com/abseil/abseil-cpp and so likely not really NFC. Also reverted subsequent r314956/7. I'll forward reproduction instructions to Richard. llvm-svn: 315439
* [LICM] Disallow sinking of unordered atomic loads into loopsMax Kazantsev2017-10-112-5/+104
| | | | | | | | | | | | | | | | | | | | | | | | Sinking of unordered atomic load into loop must be disallowed because it turns a single load into multiple loads. The relevant section of the documentation is: http://llvm.org/docs/Atomics.html#unordered, specifically the Notes for Optimizers section. Here is the full text of this section: > Notes for optimizers > In terms of the optimizer, this **prohibits any transformation that > transforms a single load into multiple loads**, transforms a store into > multiple stores, narrows a store, or stores a value which would not be > stored otherwise. Some examples of unsafe optimizations are narrowing > an assignment into a bitfield, rematerializing a load, and turning loads > and stores into a memcpy call. Reordering unordered operations is safe, > though, and optimizers should take advantage of that because unordered > operations are common in languages that need them. Patch by Daniil Suchkov! Reviewed By: reames Differential Revision: https://reviews.llvm.org/D38392 llvm-svn: 315438
* [IRCE] Do not process empty safe rangesMax Kazantsev2017-10-113-9/+85
| | | | | | | | | | | | | | | IRCE should not apply when the safe iteration range is proved to be empty. In this case we do unneeded job creating pre/post loops and then never go to the main loop. This patch makes IRCE not apply to empty safe ranges, adds test for this situation and also modifies one of existing tests where it used to happen slightly. Reviewed By: anna Differential Revision: https://reviews.llvm.org/D38577 llvm-svn: 315437
* Do not copy Sections vector.Rui Ueyama2017-10-111-1/+1
| | | | llvm-svn: 315436
* Reorder.NAKAMURA Takumi2017-10-111-1/+1
| | | | llvm-svn: 315435
* Split LinkerScript::computeInputSections into two functions.Rui Ueyama2017-10-112-33/+37
| | | | llvm-svn: 315434
* Swap parameters of getSymbolValue.Rui Ueyama2017-10-113-8/+8
| | | | | | | | | Usually, a function that does symbol lookup takes symbol name as its first argument. Also, if a function takes a source location hint, it is usually the last parameter. So the previous parameter order was counter-intuitive. llvm-svn: 315433
* Do not handle DefinedCommon in linker scripts.Rui Ueyama2017-10-111-6/+4
| | | | | | | | Because of r314495, DefinedCommon symbols cannot reach to getSymbolValue function. When they reach the fucntion, they have already been converted to DefinedRegular symbols. llvm-svn: 315432
* Rename BytesDataCommand -> ByteCommand.Rui Ueyama2017-10-114-13/+12
| | | | llvm-svn: 315431
* Inline LinkerScript::process.Rui Ueyama2017-10-111-43/+45
| | | | | | "process" was not a good name because everything can be named it. llvm-svn: 315430
* [GVN] Don't replace constants with constants.Davide Italiano2017-10-112-0/+18
| | | | | | | | This fixes PR34908. Patch by Alex Crichton! Differential Revision: https://reviews.llvm.org/D38765 llvm-svn: 315429
* ClangCodeGenTests: Update libdeps in rL315392, +clangAST.NAKAMURA Takumi2017-10-111-0/+1
| | | | llvm-svn: 315428
* Split a loop into two to make it clear that it did two different things.Rui Ueyama2017-10-111-5/+13
| | | | llvm-svn: 315427
* Use more precise type.Rui Ueyama2017-10-114-20/+17
| | | | llvm-svn: 315426
* Remove a static local varaible.Rui Ueyama2017-10-111-8/+6
| | | | | | We should generally avoid static local variables. llvm-svn: 315425
* Avoid a pointer to a pointer to an input section.Rui Ueyama2017-10-111-11/+11
| | | | llvm-svn: 315424
* Add comment.Rui Ueyama2017-10-111-0/+3
| | | | llvm-svn: 315423
* Split decompressAndMergeSection into two separate functions.Rui Ueyama2017-10-114-21/+27
| | | | | | | Even though they are called sequentially, they are separate operations, so it is better to split it. llvm-svn: 315422
* Remove useless cast.Rui Ueyama2017-10-111-3/+2
| | | | llvm-svn: 315421
* Rename filename -> getFilename.Rui Ueyama2017-10-111-3/+3
| | | | llvm-svn: 315420
* Rename Align -> Alignment.Rui Ueyama2017-10-111-2/+2
| | | | llvm-svn: 315419
* Rename CurAddressState -> Ctx.Rui Ueyama2017-10-112-45/+40
| | | | | | | | | We used CurAddressState to capture a dynamic context just like we use lambdas to capture static contexts. So, CurAddressState is used everywhere in LinkerScript.cpp. It is worth a shorter name. llvm-svn: 315418
* Revert "[llvm-objcopy] Add support for --strip-sections to remove all ↵Jake Ehrlich2017-10-114-114/+20
| | | | | | | | section headers leaving only program headers and loadable segment data" This reverts commit rL315412 llvm-svn: 315417
* Make LinkerScript::addSymbol a private member function.Rui Ueyama2017-10-111-2/+2
| | | | llvm-svn: 315416
* Rename processCommands -> processSectionCommands.Rui Ueyama2017-10-114-7/+8
| | | | llvm-svn: 315415
* Inline small functions.Rui Ueyama2017-10-112-20/+8
| | | | llvm-svn: 315414
* WIN32_FIND_DATA -> WIN32_FIND_DATAW.Peter Collingbourne2017-10-111-1/+1
| | | | | | Should fix mingw bot. llvm-svn: 315413
* [llvm-objcopy] Add support for --strip-sections to remove all section ↵Jake Ehrlich2017-10-114-20/+114
| | | | | | | | | | | | | | | | | | headers leaving only program headers and loadable segment data elf utils implements a particularly extreme form of stripping that I'd like to support. eu-strip has an option called "strip-sections" that removes all section headers and leaves only program headers and the segment data. I have implemented this option partly as a test but mainly because in Fuchsia we would like to use this option to minimize the size of our executables. The other strip options that are on my list include --strip-all and --strip-debug. This is a preliminary implementation that I'd like to start using in Fuchsia builds if possible. This change implements such a stripping option for llvm-objcopy Differential Revision: https://reviews.llvm.org/D38335 llvm-svn: 315412
* Update cc1as_main for MCAsmBackend ownership change in r315410.Lang Hames2017-10-111-2/+2
| | | | llvm-svn: 315411
* [MC] Have MCObjectStreamer take its MCAsmBackend argument via unique_ptr.Lang Hames2017-10-1139-185/+252
| | | | | | | | MCObjectStreamer owns its MCAsmBackend -- this fixes the types to reflect that, and allows us to remove another instance of MCObjectStreamer's weird "holding ownership via someone else's reference" trick. llvm-svn: 315410
* Rename Commands -> SectionCommands.Rui Ueyama2017-10-1110-64/+70
| | | | | | | | | | "Commands" was ambiguous because in the linker script, everything is a command. We used to handle only SECTIONS commands, and at the time, it might make sense to call them the commands, but it is no longer the case. We handle not only SECTIONS but also MEMORY, PHDRS, VERSION, etc., and they are all commands. llvm-svn: 315409
* [modules] Fix visibility checking for using declarations via ADL.Richard Smith2017-10-112-6/+54
| | | | | | | We want to check whether the using (shadow) declaration itself is visible, not whether its target is visible. llvm-svn: 315408
* [libFuzzer] experimental flag to tweak the corpus distribution. Seems to ↵Kostya Serebryany2017-10-115-9/+29
| | | | | | improve the situation dramatically on the png benchmark and make things worse on a number of micro-puzzles. Needs more A/B testing llvm-svn: 315407
* Silence MSVC warnings about unsigned wrapping without UBReid Kleckner2017-10-111-7/+5
| | | | | | | | | | | Of course, casting an unsigned value too large for 'int' is UB. So, write out the ternary. LLVM folds it to ADD anyway. Fixes the warning from r303693 a different way. Thanks to Erich Keane for pointing this out! llvm-svn: 315406
* Rename HasSections -> HasSectionsComand.Rui Ueyama2017-10-114-9/+9
| | | | | | | | HasSections is true if there is at least one SECTIONS linker script command, and it is not directly related to whether we have section objects or not. So I think the new name is better. llvm-svn: 315405
* Move a loop invariant outside the loop.Rui Ueyama2017-10-111-3/+2
| | | | llvm-svn: 315404
* Remove ScriptConfiguration class and move the members to LinkerScript class.Rui Ueyama2017-10-117-95/+88
| | | | | | | | | | | | | | | | ScriptConfiguration was a class to contain parsed results of linker scripts. LinkerScript is a class to interpret it. That ditinction was needed because we haven't instantiated LinkerScript early (because, IIRC, LinkerScript class was a ELFT template function). So, when we parse linker scripts, we couldn't directly store the result to a LinkerScript instance. Now, that limitation is gone. We instantiate LinkerScript at the very beginning of our main function. We can directly store parse results to a LinkerScript instance. llvm-svn: 315403
* [modules] Only take visible using-directives into account during name lookup.Richard Smith2017-10-112-14/+78
| | | | llvm-svn: 315402
* Inline addRegular into addSymbol.Rui Ueyama2017-10-112-42/+52
| | | | | | | | Because addRegular's functionality is tightly coupled with addSymbol, and the former is called only once, it makes sense to merge the two functions. This patch also adds comments. llvm-svn: 315401
* COFF: When generating code for LTO, use static reloc model on 32-bit x86.Peter Collingbourne2017-10-112-1/+26
| | | | | | | | | | | | | | Fixes PR34306. This is because it usually results in more compact code, and because there are also known code generation bugs when using the PIC model (see bug). Based on a patch by Carlo Kok. Differential Revision: https://reviews.llvm.org/D38769 llvm-svn: 315400
* [X86] Remove temporary std::string creation from shuffle comment printing. ↵Craig Topper2017-10-111-12/+12
| | | | | | We can just write directly to the raw_ostream. llvm-svn: 315399
* A '<' with a trigraph '#' is not a valid editor placeholderAlex Lorenz2017-10-112-1/+6
| | | | | | | | | Credit to OSS-Fuzz for discovery: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3137#c5 rdar://34923985 llvm-svn: 315398
* [Modules TS] Diagnose missing/duplicate module-declaration.Richard Smith2017-10-115-6/+44
| | | | llvm-svn: 315397
* [sanitizer] Re-disable several tests on Android.Evgeniy Stepanov2017-10-116-6/+6
| | | | | | The tests have been enabled by accident in r315389. llvm-svn: 315396
* [X86] Add 128-bit version of vbroadcasti32x2 to shuffle comment decoding.Craig Topper2017-10-113-10/+21
| | | | llvm-svn: 315395
OpenPOWER on IntegriCloud