summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* [elf2] Inline needsDynamicSections.Michael J. Spencer2015-10-121-5/+4
| | | | llvm-svn: 250125
* [msan] Add __msan_copy_shadow interface function.Evgeniy Stepanov2015-10-124-0/+48
| | | | | | This can be used to annotate copies of memory that are not observed by MSan. llvm-svn: 250124
* [ELF2/PPC64] Resolve local-call relocations using the correct ↵Hal Finkel2015-10-124-5/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function-descriptor values Under PPC64 ELF v1 ABI, the symbols associated with each function name don't point directly to the code in the .text section (or similar), but rather to a function descriptor structure in a special data section named .opd. The elements in the .opd structure include a pointer to the actual code, and a the relevant TOC base value. Both of these are themselves set by relocations. When we have a local call, we need the relevant relocation to refer directly to the target code, not to the function-descriptor in the .opd section. Only when we have a .plt stub do we care about the address of the .opd function descriptor itself. So we make a few changes here: 1. Always write .opd first, so that its relocated data values are available for later use when writing the text sections. Record a pointer to the .opd structure, and its corresponding buffer. 2. When processing a relative branch relocation under ppc64, if the destination points into the .opd section, read the code pointer out of the function descriptor structure and use that instead. This this, I can link, and run, a dynamically-compiled "hello world" application on big-Endian PPC64/Linux (ELF v1 ABI) using lld. llvm-svn: 250122
* [InstCombine] Tidied up SSE4A tests.Simon Pilgrim2015-10-121-37/+39
| | | | | | First stage of bugfix discussed in D13348 llvm-svn: 250121
* Temporarily remove the test added in r250117 while I investigate why twoKevin Enderby2015-10-121-6/+0
| | | | | | of the build bots get a different error on that malformed file. llvm-svn: 250120
* Assign correct edge weights to unwind destinations when lowering invoke ↵Cong Hou2015-10-125-36/+140
| | | | | | | | | | statement. When lowering invoke statement, all unwind destinations are directly added as successors of call site block, and the weight of those new edges are not assigned properly. Actually, default weight 16 are used for those edges. This patch calculates the proper edge weights for those edges when collecting all unwind destinations. Differential revision: http://reviews.llvm.org/D13354 llvm-svn: 250119
* [SelectionDAG] Add common vector constant folding helper functionSimon Pilgrim2015-10-123-101/+99
| | | | | | | | | | | | We have a number of functions that implement constant folding of vectors (unary and binary ops) in near identical manners (and the differences don't appear to be critical). This patch introduces a common implementation (SelectionDAG::FoldConstantVectorArithmetic) and calls this in both the unary and binary op cases. After this initial patch I intend to begin enabling vector constant folding for a wider number of opcodes in SelectionDAG::getNode(). Differential Revision: http://reviews.llvm.org/D13665 llvm-svn: 250118
* Fixed bugs in llvm-obdump while parsing Mach-O files from malformed archivesKevin Enderby2015-10-124-0/+19
| | | | | | | | | that caused aborts. This was because of the characters of the ‘Size’ field in the archive header did not contain decimal characters. rdar://22983603 llvm-svn: 250117
* [clang-tidy] new check cppcoreguidelines-pro-bounds-pointer-arithmeticMatthias Gehre2015-10-127-0/+189
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This check flags all usage of pointer arithmetic, because it could lead to an invalid pointer. Subtraction of two pointers is not flagged by this check. Pointers should only refer to single objects, and pointer arithmetic is fragile and easy to get wrong. array_view is a bounds-checked, safe type for accessing arrays of data. This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds1-dont-use-pointer-arithmetic-use-array_view-instead Depends on D13313 Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13311 llvm-svn: 250116
* [ELF2/LinkerScript] Implement parsing of OUTPUT_ARCH() command.Davide Italiano2015-10-122-0/+20
| | | | | | Differential Revision: http://reviews.llvm.org/D13675 llvm-svn: 250115
* Add decayedType and hasDecayedType AST matchersMatthias Gehre2015-10-124-0/+42
| | | | | | | | | | | | Summary: Add decayedType and hasDecayedType AST matchers Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13639 llvm-svn: 250114
* [asan] Zero initialize sem_t in sem_init.Evgeniy Stepanov2015-10-124-7/+61
| | | | | | | | | | Old version of sem_init (GLIBC_2.0) fails to initialize parts of sem_t that are used in sem_timedwait. This is fixed in GLIBC_2.1, but since ASan interceptors downgrade sem_* to the oldest available version, this can introduce bugs that are only present in sanitized build. Workaround by zero-initializing sem_t in sem_init. llvm-svn: 250113
* test: change argumentSaleem Abdulrasool2015-10-121-1/+1
| | | | | | | This failed on AArch64 due to the type mismatch using int instead of __builtin_va_list. llvm-svn: 250112
* test: relax path matching for windowsSaleem Abdulrasool2015-10-121-9/+9
| | | | | | The test failed on Windows due to use of \ as a path separator rather than /. llvm-svn: 250111
* [ELF2] Allow PPC64 to add the TOC-restore after .plt-based relocationsHal Finkel2015-10-126-35/+111
| | | | | | | | | | | | | | | | | | | | | | | Under the PPC64 ELF ABI, functions that might call into other modules (and, thus, need to load a different TOC base value into %r2), need to restore the old value after the call. The old value is saved by the .plt code, and the caller only needs to include a nop instruction after the call, which the linker will transform into a TOC restore if necessary. In order to do this the relocation handler needs two things: 1. It needs to know whether the call instruction it is modifying is targeting a .plt stub that will load a new TOC base value (necessitating a restore after the call). 2. It needs to know where the buffer ends, so that it does not accidentally run off the end of the buffer when looking for the 'nop' instruction after the call. Given these two pieces of information, we can insert the restore instruction in place of the following nop when necessary. llvm-svn: 250110
* [ELF2] Ensure strict weak ordering in section sortingHal Finkel2015-10-121-2/+2
| | | | | | | As pointed out by Rui (post-commit review), we need to always return based on the section type when the types differ to ensure a strict weak ordering. llvm-svn: 250109
* [CMake] Adding support for passing in profiling data.Chris Bieneman2015-10-121-0/+7
| | | | | | Adds LLVM_PROFDATA_FILE option to allow specifying a profile data file to be used during compilation of LLVM and subprojects. llvm-svn: 250108
* test/elf2/relative-dynamic-reloc-ppc64.s requires ppcHal Finkel2015-10-121-0/+1
| | | | | | Fix the buildbot; this test also requires ppc target support. llvm-svn: 250107
* [ELF2/LinkerScript] Fix OUTPUT_FORMAT directive parsingDavide Italiano2015-10-122-0/+18
| | | | | | Differential Revision: http://reviews.llvm.org/D13668 llvm-svn: 250106
* Add warning flags for #include_next and some nearby warnings.Richard Smith2015-10-123-12/+15
| | | | llvm-svn: 250105
* [ELF2] Fixup test case for TOC relocationHal Finkel2015-10-121-1/+1
| | | | | | | Now that the target relocation handle will see R_PPC64_TOC, fix the test case accordingly. llvm-svn: 250104
* [ELF2] Implement PPC64TargetInfo::isRelRelativeHal Finkel2015-10-123-0/+81
| | | | | | | This is essentially pattern-matching against the x86 target, and generates the analogous PPC64 relocation. llvm-svn: 250102
* [ELF2] Add a base set of PPC64 relocationsHal Finkel2015-10-122-11/+307
| | | | | | | | | This is mostly an adaptation of the code in LLVM's lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp, and handles a sufficient number of relocations to link a 'hello world' program on big-Endian PPC64/Linux (ELF v1 ABI). llvm-svn: 250101
* [ELF2] Sort PPC64 special sectionsHal Finkel2015-10-122-29/+97
| | | | | | | | | | | | | PPC64 has several special sections that are intended to be accessed from the TOC base pointer. When a .got is present, the TOC base pointer is .got + 0x8000 (as specified by the ABI). Furthermore, the glibc startup code contains an assumption that a 16-bit relocation can hold the offset from the TOC base value to the beginning of the .toc section. Thus, we need to make sure that .toc appears after .got. This much, at least, is required in practice. The other PPC64 special sections (.toc, .toc1, .opd, etc.) should also be close by to optimize access by smaller TOC-base-pointer offsets. llvm-svn: 250100
* Parse and ignore #pragma runtime_checks in MS extensions mode (PR25138)Hans Wennborg2015-10-125-4/+16
| | | | | | We already silently ignore the /RTC, which controls the same functionality. llvm-svn: 250099
* [clang-tidy] add check cppcoreguidelines-pro-type-static-cast-downcastMatthias Gehre2015-10-127-0/+218
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This check flags all usages of static_cast, where a base class is casted to a derived class. In those cases, a fixit is provided to convert the cast to a dynamic_cast. Use of these casts can violate type safety and cause the program to access a variable that is actually of type X to be accessed as if it were of an unrelated type Z. This rule is part of the "Type safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type2-dont-use-static_cast-downcasts-use-dynamic_cast-instead Depends on D13313 Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13368 llvm-svn: 250098
* Fix Bug 25103 - _cxa_demangle improperly demangles virtual thunks. Thanks to ↵Marshall Clow2015-10-122-1/+3
| | | | | | Jason King for the report and suggested fix llvm-svn: 250097
* Continue early to reduce indentation.Rui Ueyama2015-10-121-17/+18
| | | | llvm-svn: 250096
* ELF2: Create a function to get VA from Elf_Rel.Rui Ueyama2015-10-123-16/+23
| | | | | | And remove git getLocalSymVA because there's no user of the function anymore. llvm-svn: 250095
* Support Debug Info path remappingSaleem Abdulrasool2015-10-129-8/+88
| | | | | | | | | | | | | | | | Add support for the `-fdebug-prefix-map=` option as in GCC. The syntax is `-fdebug-prefix-map=OLD=NEW`. When compiling files from a path beginning with OLD, change the debug info to indicate the path as start with NEW. This is particularly helpful if you are preprocessing in one path and compiling in another (e.g. for a build cluster with distcc). Note that the linearity of the implementation is not as terrible as it may seem. This is normally done once per file with an expectation that the map will be small (1-2) entries, making this roughly linear in the number of input paths. Addresses PR24619. llvm-svn: 250094
* Support RHEL 7 and similar systems that use architecture-specific Python lib ↵Todd Fiala2015-10-124-1/+83
| | | | | | | | dirs This change commits: http://reviews.llvm.org/D13625 llvm-svn: 250093
* RegisterPasses: Optionally run inliner before PollyTobias Grosser2015-10-121-0/+13
| | | | | | | | This will allow us to optimize C++ template code with Polly. This support is mostly for debugging purpose and individual experiments. The ultimate goal is still to run Polly later in the pass manager when inlining already happened. llvm-svn: 250092
* Use EP_ModuleOptimizerEarly to run early polly passes,Tobias Grosser2015-10-121-3/+3
| | | | | | | | instead of llvm::PassManagerBuilder::EP_EarlyAsPossible. This will allow us to run actual module passes in Polly's canonicalization sequence, but should otherwise have only little impact. llvm-svn: 250091
* [Sema] Make `&function_with_enable_if_attrs` an errorGeorge Burgess IV2015-10-129-23/+228
| | | | | | | | | | | | | | | | | | This fixes a bug where one can take the address of a conditionally enabled function to drop its enable_if guards. For example: int foo(int a) __attribute__((enable_if(a > 0, ""))); int (*p)(int) = &foo; int result = p(-1); // compilation succeeds; calls foo(-1) Overloading logic has been updated to reflect this change, as well. Functions with enable_if attributes that are always true are still allowed to have their address taken. Differential Revision: http://reviews.llvm.org/D13607 llvm-svn: 250090
* Update the branch weight metadata in JumpThreading pass.Cong Hou2015-10-127-5/+222
| | | | | | | | In JumpThreading pass, the branch weight metadata is not updated after CFG modification. Consider the jump threading on PredBB, BB, and SuccBB. After jump threading, the weight on BB->SuccBB should be adjusted as some of it is contributed by the edge PredBB->BB, which doesn't exist anymore. This patch tries to update the edge weight in metadata on BB->SuccBB by scaling it by 1 - Freq(PredBB->BB) / Freq(BB->SuccBB). Differential revision: http://reviews.llvm.org/D10979 llvm-svn: 250089
* Make Win64 localescape offsets FP relative instead of SP relativeReid Kleckner2015-10-122-26/+35
| | | | | | | | | We made them SP relative back in March (r233137) because that's the value the runtime passes to EH functions. With the new cleanuppad IR, funclets adjust their frame argument from SP to FP, so our offsets should now be FP-relative. llvm-svn: 250088
* [ELF2/PPC64] Add a comment about the page sizeHal Finkel2015-10-121-0/+4
| | | | | | | Rafael requested some additional commentary (post-commit review of r249760), to make it clear this is intended and necessary. llvm-svn: 250087
* [llvm-symbolizer] Add -print-address optionHemant Kulkarni2015-10-125-0/+30
| | | | | | Differential Revision: http://reviews.llvm.org/D13518 llvm-svn: 250086
* [x86] Fix wrong lowering of vsetcc nodes (PR25080).Andrea Di Biagio2015-10-122-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Function LowerVSETCC (in X86ISelLowering.cpp) worked under the wrong assumption that for non-AVX512 targets, the source type and destination type of a type-legalized setcc node were always the same type. This assumption was unfortunately incorrect; the type legalizer is not always able to promote the return type of a setcc to the same type as the first operand of a setcc. In the case of a vsetcc node, the legalizer firstly checks if the first input operand has a legal type. If so, then it promotes the return type of the vsetcc to that same type. Otherwise, the return type is promoted to the 'next legal type', which, for vectors of MVT::i1 is always a 128-bit integer vector type. Example (-mattr=+avx): %0 = trunc <8 x i32> %a to <8 x i23> %1 = icmp eq <8 x i23> %0, zeroinitializer The initial selection dag for the code above is: v8i1 = setcc t5, t7, seteq:ch t5: v8i23 = truncate t2 t2: v8i32,ch = CopyFromReg t0, Register:v8i32 %vreg1 t7: v8i32 = build_vector of all zeroes. The type legalizer would firstly check if 't5' has a legal type. If so, then it would reuse that same type to promote the return type of the setcc node. Unfortunately 't5' is of illegal type v8i23, and therefore it cannot be used to promote the return type of the setcc node. Consequently, the setcc return type is promoted to v8i16. Later on, 't5' is promoted to v8i32 thus leading to the following dag node: v8i16 = setcc t32, t25, seteq:ch where t32 and t25 are now values of type v8i32. Before this patch, function LowerVSETCC would have wrongly expanded the setcc to a single X86ISD::PCMPEQ. Surprisingly, ISel was still able to match an instruction. In our case, ISel would have matched a VPCMPEQWrr: t37: v8i16 = X86ISD::VPCMPEQWrr t36, t25 However, t36 and t25 are both VR256, while the result type is instead of class VR128. This inconsistency ended up causing the insertion of COPY instructions like this: %vreg7<def> = COPY %vreg3; VR128:%vreg7 VR256:%vreg3 Which is an invalid full copy (not a sub register copy). Eventually, the backend would have hit an UNREACHABLE "Cannot emit physreg copy instruction" in the attempt to expand the malformed pseudo COPY instructions. This patch fixes the problem adding the missing logic in LowerVSETCC to handle the corner case of a setcc with 128-bit return type and 256-bit operand type. This problem was originally reported by Dimitry as PR25080. It has been latent for a very long time. I have added the minimal reproducible from that bugzilla as test setcc-lowering.ll. Differential Revision: http://reviews.llvm.org/D13660 llvm-svn: 250085
* Fix a misunderstanding of the ThreadPlan::OkayToDiscard flag in ↵Jim Ingham2015-10-122-18/+84
| | | | | | | | | | | | | InferiorCallPOSIX. It was set to true, but all plans run by RunThreadPlan need to have this set to false so they will return control to RunThreadPlan without consulting plans higher on the stack. Since this seems like a common error, I also modified RunThreadPlan to enforce this behavior. <rdar://problem/22543166> llvm-svn: 250084
* Return the right answer for ShouldStop for the RunToAddress plan. This isn'tJim Ingham2015-10-121-1/+1
| | | | | | | strictly necessary because RunToAddress is always used as a subsidiary plan, so it's ShouldStop seldom matters. But get it right anyway. llvm-svn: 250083
* Add a doc string for ReturnFromFrame.Jim Ingham2015-10-121-0/+7
| | | | llvm-svn: 250082
* Fix test for change in a summary string (objects -> elements).Jim Ingham2015-10-121-6/+6
| | | | llvm-svn: 250081
* Instead of computing offset from current and start, use a variable. NFC.Rui Ueyama2015-10-121-4/+4
| | | | llvm-svn: 250080
* Remove break after error because error is _Noreturn.Rui Ueyama2015-10-121-5/+0
| | | | llvm-svn: 250079
* [Sema] Don't emit multiple diags for one errorGeorge Burgess IV2015-10-122-12/+16
| | | | | | | | | Fixed a bug where we'd emit multiple diagnostics if there was a problem taking the address of an overloaded template function. Differential Revision: http://reviews.llvm.org/D13664 llvm-svn: 250078
* Add - and -= operators to BlockFrequency using saturating arithmetic.Cong Hou2015-10-123-0/+25
| | | | llvm-svn: 250077
* [libFuzzer] mention more trophies and improve the link formattingKostya Serebryany2015-10-121-5/+8
| | | | llvm-svn: 250076
* combine predicates; NFCISanjay Patel2015-10-121-4/+1
| | | | llvm-svn: 250075
* Turn const/const& into value type for BlockFrequency in functions of this ↵Cong Hou2015-10-122-15/+13
| | | | | | class. Also fix a naming issue. NFC. llvm-svn: 250074
OpenPOWER on IntegriCloud