summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* [llvm-mca] Fix unused variable warning in opt mode.Clement Courbet2018-03-131-1/+1
| | | | llvm-svn: 327394
* [Hexagon] Clang side of r327302 in LLVMKrzysztof Parzyszek2018-03-132-24/+38
| | | | | | | Add option -m[no-]packets to control generation of instruction packets (enabled by default). llvm-svn: 327393
* [WebAssembly] Demangle symbol names for use by the browser debuggerNicholas Wilson2018-03-133-3/+75
| | | | | | Differential Revision: https://reviews.llvm.org/D44316 llvm-svn: 327392
* [WebAssembly] Use helper macro from ELF/Options.td to tidy. NFCNicholas Wilson2018-03-131-15/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D44394 llvm-svn: 327391
* [WebAssembly] Add missing --demangle argNicholas Wilson2018-03-133-0/+27
| | | | | | | | | Previously, Config->Demangle was uninitialised (not hooked up to commandline handling) Differential Revision: https://reviews.llvm.org/D44301 llvm-svn: 327390
* [llvm-mca] Refactor event listeners to make the backend agnostic to event types.Clement Courbet2018-03-1312-137/+162
| | | | | | | | | | Summary: This is a first step towards making the pipeline configurable. Subscribers: llvm-commits, andreadb Differential Revision: https://reviews.llvm.org/D44309 llvm-svn: 327389
* [mips] Don't create nested CALLSEQ_START..CALLSEQ_END nodes.Simon Dardis2018-03-132-8/+473
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the MIPS O32 ABI, the current call lowering logic naively lowers each call, creating the reserved argument area to hold the argument spill areas for $a0..$a3 and the outgoing parameter area if one is required at each call site. In the case of a sufficently large byval argument, a call to memcpy is used to write the start+16..end of the argument into the outgoing parameter area. This is done within the CALLSEQ_START..CALLSEQ_END of the callee. The CALLSEQ nodes are responsible for performing the necessary stack adjustments. Since the O32/N32/N64 MIPS ABIs do not have a red-zone and writing below the stack pointer and reading the values back is unpredictable, the call to memcpy cannot be hoisted out of the callee's CALLSEQ nodes. However, for the O32 ABI requires the reserved argument area for functions which have parameters. The naive lowering of calls will then create nested CALLSEQ sequences. For N32 and N64 these nodes are also created, but with zero stack adjustments as those ABIs do not have a reserved argument area. This patch addresses the correctness issue by recognizing the special case of lowering a byval argument that uses memcpy. By recognizing that the incoming chain already has a CALLSEQ_START node on it when calling memcpy, the CALLSEQ nodes are not created. For the N32 and N64 ABIs, this is not an issue, as no stack adjustment has to be performed. For the O32 ABI, the correctness reasoning is different. In the case of a sufficently large byval argument, registers a0..a3 are going to be used for the callee's arguments, mandating the creation of the reserved argument area. The call to memcpy in the naive case will also create its own reserved argument area. However, since the reserved argument area consists of undefined values, both calls can use the same reserved argument area. Reviewers: abeserminji, atanasyan Differential Revision: https://reviews.llvm.org/D44296 llvm-svn: 327388
* [clangd] Fix irrelevant declaratations in goto definition (on macros).Haojian Wu2018-03-132-0/+19
| | | | | | | | | | | | | | | Summary: DeclrationAndMacrosFinder will find some declarations (not macro!) that are referened inside the macro somehow, isSearchedLocation() is not sufficient, we don't know whether the searched source location is macro or not. Reviewers: ilya-biryukov Subscribers: klimek, jkorous-apple, ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D44293 llvm-svn: 327387
* [clangd] Remove extra ";", NFC.Haojian Wu2018-03-131-1/+1
| | | | llvm-svn: 327386
* [X86][SSE41] createVariablePermute v2X64 - PCMPEQQ can test for index 0/1 ↵Simon Pilgrim2018-03-132-15/+22
| | | | | | and select between them. llvm-svn: 327385
* [dsymutil] Unbreak non-Darwin bots.Jonas Devlieghere2018-03-131-3/+3
| | | | | | BinaryHolder -> BinHolder llvm-svn: 327384
* clang-import-test: fix build with clang-3.8Pavel Labath2018-03-131-1/+1
| | | | | | | | clang-3.8 complains that constructor for '...' must explicitly initialize the const object. Newer clangs and gcc seem to be fine with this, but explicitly initializing the variable does not hurt. llvm-svn: 327383
* [dsymutil] Introduce LinkContext. NFC.Jonas Devlieghere2018-03-132-219/+338
| | | | | | | | This patch introduces the LinkContext which is necessary to have dsymutil perform analysis and cloning of DIEs in parallel. As requested in D43945, I'm landing this as two separate commits. llvm-svn: 327382
* [Evaluator] Evaluate load/store with bitcastEugene Leviant2018-03-134-46/+95
| | | | | | Differential revision: https://reviews.llvm.org/D43457 llvm-svn: 327381
* Fix clang-3.8 buildPavel Labath2018-03-131-1/+1
| | | | | | | | clang-3.8 complains that constructor for '...' must explicitly initialize the const member. Newer clangs and gcc seem to be fine with this, but explicitly initializing the member does not hurt. llvm-svn: 327380
* Fix linux s390x build (pr36694)Pavel Labath2018-03-131-1/+1
| | | | llvm-svn: 327379
* [ELF] - Implement INSERT BEFORE.George Rimar2018-03-136-16/+60
| | | | | | | | | | | This finishes PR35877. INSERT BEFORE used similar to INSERT AFTER, it inserts sections before the given target section. Differential revision: https://reviews.llvm.org/D44380 llvm-svn: 327378
* [ELF] - Fix wrong "REQUIRES" in test.George Rimar2018-03-131-1/+1
| | | | | | Its a follow up for r327374 to fix BB. llvm-svn: 327377
* [ELF] - Restrict section offsets that exceeds file size.George Rimar2018-03-133-6/+53
| | | | | | | | | | | | | | | | | This is part of PR36515. With some linkerscripts it is possible to get file offset overlaps and overflows. Currently LLD checks overlaps in checkNoOverlappingSections(). And also we allow broken output with --no-inhibit-exec. Problem is that sometimes final offset of sections is completely broken and we calculate output file size wrong and might crash. Patch implements check to verify that there is no output section which offset exceeds file size. Differential revision: https://reviews.llvm.org/D43819 llvm-svn: 327376
* [CodeGenPrepare] Respect endianness in splitMergedValStore.Jonas Paulsson2018-03-132-1/+24
| | | | | | | | | | | | | splitMergedValStore will split a store into two if target prefers this, or if -force-split-store is passed. This patch adds the missing handling for endianness in this function along with a test case. Review: Eli Friedman https://reviews.llvm.org/D44396 llvm-svn: 327375
* [ELF] - Drop special flags for empty output sections.George Rimar2018-03-132-7/+32
| | | | | | | | | | | | | | | | This fixes PR36598. LLD currently crashes when we have empty output section with SHF_LINK_ORDER flag. This might happen if we place an empty synthetic section in the linker script, but keep output section alive with the use of additional symbol, for example. The patch fixes the issue by dropping all special flags for empty sections. Differential revision: https://reviews.llvm.org/D44376 llvm-svn: 327374
* [SCEV][NFC] Smarter implementation of isAvailableAtLoopEntryMax Kazantsev2018-03-131-53/+1
| | | | | | | | | | isAvailableAtLoopEntry duplicates logic of `properlyDominates` after checking invariance. This patch replaces this logic with invocation of this method which is more profitable because it supports caching. Differential Revision: https://reviews.llvm.org/D43997 llvm-svn: 327373
* [MergeICmps] Make sure that the comparison only has one use.Clement Courbet2018-03-132-0/+109
| | | | | | | | | | | | Summary: Fixes PR36557. Reviewers: trentxintong, spatel Subscribers: mstorsjo, llvm-commits Differential Revision: https://reviews.llvm.org/D44083 llvm-svn: 327372
* bpf: Enhance debug information for peephole optimization passesYonghong Song2018-03-131-1/+19
| | | | | | | | | | | Add more debug information for peephole optimization passes. These would only be enabled for debug version binary and could help analyzing why some optimization opportunities were missed. Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Signed-off-by: Yonghong Song <yhs@fb.com> llvm-svn: 327371
* bpf: New post-RA peephole optimization pass to eliminate bad RA codegenYonghong Song2018-03-133-8/+111
| | | | | | | | | | | | | | | | | This new pass eliminate identical move: MOV rA, rA This is particularly possible to happen when sub-register support enabled. The special type cast insn MOV_32_64 involves different register class on src (i32) and dst (i64), RA could generate useless instruction due to this. This pass also could serve as the bast for further post-RA optimization. Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Signed-off-by: Yonghong Song <yhs@fb.com> llvm-svn: 327370
* bpf: Don't expand BSWAP on i32, promote itYonghong Song2018-03-131-1/+1
| | | | | | | | | | | | | | | Currently, there is no ALU32 bswap support in eBPF ISA. BSWAP on i32 was set to EXPAND which would need about eight instructions for single BSWAP. It would be more efficient to promote it to i64, then doing BSWAP on i64. For eBPF programs, most of the promotion are zero extensions which are likely be elimiated later by peephole optimizations. Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Signed-off-by: Yonghong Song <yhs@fb.com> llvm-svn: 327369
* bpf: Support subregister definition check on PHI nodeYonghong Song2018-03-131-2/+16
| | | | | | | | | | | | | This patch relax the subregister definition check on Phi node. Previously, we just cancel the optimizatoin when the definition is Phi node while actually we could further check the definitions of incoming parameters of PHI node. This helps catch more elimination opportunities. Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Signed-off-by: Yonghong Song <yhs@fb.com> llvm-svn: 327368
* bpf: Extends zero extension elimination beyond comparison instructionsYonghong Song2018-03-132-93/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | The current zero extension elimination was restricted to operands of comparison. It actually could be extended to more cases. For example: int *inc_p (int *p, unsigned a) { return p + a; } 'a' will be promoted to i64 during addition, and the zero extension could be eliminated as well. For the elimination optimization, it should be much better to start recognizing the candidate sequence from the SRL instruction instead of J* instructions. This patch makes it an generic zero extension elimination pass instead of one restricted with comparison. Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Signed-off-by: Yonghong Song <yhs@fb.com> llvm-svn: 327367
* bpf: J*_RR should check both operandsYonghong Song2018-03-132-6/+24
| | | | | | | | | | | | | There is a mistake in current code that we "break" out the optimization when the first operand of J*_RR doesn't qualify the elimination. This caused some elimination opportunities missed, for example the one in the testcase. The code should just fall through to handle the second operand. Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Signed-off-by: Yonghong Song <yhs@fb.com> llvm-svn: 327366
* bpf: Tighten subregister definition checkYonghong Song2018-03-132-1/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current subregister definition check stops after the MOV_32_64 instruction. This means we are thinking all the following instruction sequences are safe to be eliminated: MOV_32_64 rB, wA SLL_ri rB, rB, 32 SRL_ri rB, rB, 32 However, this is *not* true. The source subregister wA of MOV_32_64 could come from a implicit truncation of 64-bit register in which case the high bits of the 64-bit register is not zeroed, therefore we can't eliminate above sequence. For example, for i32_val, we shouldn't do the elimination: long long bar (); int foo (int b, int c) { unsigned int i32_val = (unsigned int) bar(); if (i32_val < 10) return b; else return c; } Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Signed-off-by: Yonghong Song <yhs@fb.com> llvm-svn: 327365
* bpf: Add more check directives in peephole testcaseYonghong Song2018-03-131-0/+4
| | | | | | | | | | | Improve the test accuracy by adding more check directives. Shifts are expected to be eliminated for zero extension but not for signed extension. Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Signed-off-by: Yonghong Song <yhs@fb.com> llvm-svn: 327364
* Revert [SCEV] Fix isKnownPredicateSerguei Katkov2018-03-133-119/+27
| | | | | | | | It is a revert of rL327362 which causes build bot failures with assert like Assertion `isAvailableAtLoopEntry(RHS, L) && "RHS is not available at Loop Entry"' failed. llvm-svn: 327363
* [SCEV] Fix isKnownPredicateSerguei Katkov2018-03-133-27/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IsKnownPredicate is updated to implement the following algorithm proposed by @sanjoy and @mkazantsev : isKnownPredicate(Pred, LHS, RHS) { Collect set S all loops on which either LHS or RHS depend. If S is non-empty a. Let PD be the element of S which is dominated by all other elements of S b. Let E(LHS) be value of LHS on entry of PD. To get E(LHS), we should just take LHS and replace all AddRecs that are attached to PD on with their entry values. Define E(RHS) in the same way. c. Let B(LHS) be value of L on backedge of PD. To get B(LHS), we should just take LHS and replace all AddRecs that are attached to PD on with their backedge values. Define B(RHS) in the same way. d. Note that E(LHS) and E(RHS) are automatically available on entry of PD, so we can assert on that. e. Return true if isLoopEntryGuardedByCond(Pred, E(LHS), E(RHS)) && isLoopBackedgeGuardedByCond(Pred, B(LHS), B(RHS)) Return true if Pred, L, R is known from ranges, splitting etc. } This is follow-up for https://reviews.llvm.org/D42417. Reviewers: sanjoy, mkazantsev, reames Reviewed By: sanjoy, mkazantsev Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D43507 llvm-svn: 327362
* [polly] Change std::sort to llvm::sort in response to r327219Mandeep Singh Grang2018-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. Reviewers: grosser, efriedma, jdoerfert, bollu, sebpop Reviewed By: sebpop Subscribers: sebpop, mehdi_amini, llvm-commits, pollydev Tags: #polly Differential Revision: https://reviews.llvm.org/D44361 llvm-svn: 327361
* Reland r327041: [ThinLTO] Keep available_externally symbols liveVlad Tsyrklevich2018-03-134-3/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change fixes PR36483. The bug was originally introduced by a change that marked non-prevailing symbols dead. This broke LowerTypeTests handling of available_externally functions, which are non-prevailing. LowerTypeTests uses liveness information to avoid emitting thunks for unused functions. Marking available_externally functions dead is incorrect, the functions are used though the function definitions are not. This change keeps them live, and lets the EliminateAvailableExternally/GlobalDCE passes remove them later instead. (Reland with a suspected fix for a unit test failure I haven't been able to reproduce locally) Reviewers: pcc, tejohnson Reviewed By: tejohnson Subscribers: grimar, mehdi_amini, inglorion, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D43690 llvm-svn: 327360
* [LTO] Return proper error object rather than null LTOModuleAdam Nemet2018-03-131-1/+1
| | | | | | | | This caused a crash in LTOModule::createInLocalContext. rdar://37926841 llvm-svn: 327359
* [ThinLTO] Add funtions in callees metadata to CallGraphEdgesTaewook Oh2018-03-133-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: If there's a callees metadata attached to the indirect call instruction, add CallGraphEdges to the callees mentioned in the metadata when computing FunctionSummary. * Why this is necessary: Consider following code example: ``` (foo.c) static int f1(int x) {...} static int f2(int x); static int (*fptr)(int) = f2; static int f2(int x) { if (x) fptr=f1; return f1(x); } int foo(int x) { (*fptr)(x); // !callees metadata of !{i32 (i32)* @f1, i32 (i32)* @f2} would be attached to this call. } (bar.c) int bar(int x) { return foo(x); } ``` At LTO time when `foo.o` is imported into `bar.o`, function `foo` might be inlined into `bar` and PGO-guided indirect call promotion will run after that. If the profile data tells that the promotion of `@f1` or `@f2` is beneficial, the optimizer will check if the "promoted" `@f1` or `@f2` (such as `@f1.llvm.0` or `@f2.llvm.0`) is available. Without this patch, importing `!callees` metadata would only add promoted declarations of `@f1` and `@f2` to the `bar.o`, but still the optimizer will assume that the function is available and perform the promotion. The result of that is link failure with `undefined reference to @f1.llvm.0`. This patch fixes this problem by adding callees in the `!callees` metadata to CallGraphEdges so that their definition would be properly imported into. One may ask that there already is a logic to add indirect call promotion targets to be added to CallGraphEdges. However, if profile data says "indirect call promotion is only beneficial under a certain inline context", the logic wouldn't work. In the code example above, if profile data is like ``` bar:1000000:100000 1:100000 1: foo:100000 1: 100000 f1:100000 ``` , Computing FunctionSummary for `foo.o` wouldn't add `foo->f1` to CallGraphEdges. (Also, it is at least "possible" that one can provide profile data to only link step but not to compilation step). Reviewers: tejohnson, mehdi_amini, pcc Reviewed By: tejohnson Subscribers: inglorion, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D44399 llvm-svn: 327358
* Use PLT relocations in test.Rafael Espindola2018-03-131-4/+4
| | | | | | | | Currently lld creates plain plt entries when a R_386_PC32 resolves to a symbol in a shared library. That is a bug (PR36678). Don't depend on that behavior on this test. llvm-svn: 327357
* [ExpressionParser] Fix crash when evaluating invalid expresssions.Davide Italiano2018-03-133-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Typical example, illformed comparisons (operator== where LHS and RHS are not compatible). If a symbol matched `operator==` in any of the object files lldb inserted a generic function declaration in the ASTContext on which Sema operates. Maintaining the AST context invariants is fairly tricky and sometimes resulted in crashes inside clang (or assertions hit). The real reason why this feature exists in the first place is that of allowing users to do something like: (lldb) call printf("patatino") even if the debug informations for printf() is not available. Eventually, we might reconsider this feature in its entirety, but for now we can't remove it as it would break a bunch of users. Instead, try to limit it to non-C++ symbols, where getting the invariants right is hopefully easier. Now you can't do in lldb anymore (lldb) call _Zsomethingsomething(1,2,3) but that doesn't seem to be such a big loss. <rdar://problem/35645893> llvm-svn: 327356
* [LegalizeTypes] In SplitVecOp_TruncateHelper, use GetSplitVector on the ↵Craig Topper2018-03-132-330/+167
| | | | | | input instead of creating new extract_subvectors. llvm-svn: 327355
* Add missing "env" so that test added in r327322 passes on Windows bots.Douglas Yung2018-03-131-1/+1
| | | | llvm-svn: 327354
* [lld] Fix comdat testsAlexander Shaposhnikov2018-03-133-0/+10
| | | | | | | This diff adjusts the comdat tests after changing the format of llvm-readobj output for .group sections. llvm-svn: 327353
* [CFG] [analyzer] Don't add construction context to a return-by-reference call.Artem Dergachev2018-03-124-6/+62
| | | | | | | | | | | | | | Call expressions that return objects by an lvalue reference or an rvalue reference have a value type in the AST but wear an auxiliary flag of being an lvalue or an xvalue respectively. Use the helper method for obtaining the actual return type of the function. Fixes a crash. Differential Revision: https://reviews.llvm.org/D44273 llvm-svn: 327352
* ObjCARC: address review comments from majnemerSaleem Abdulrasool2018-03-121-8/+5
| | | | | | | I forgot to incorporate these comments into the original revision. This is just code cleanup addressing the feedback, NFC. llvm-svn: 327351
* [lit] `llvm-mc` is now a dependency to run tests.Davide Italiano2018-03-121-0/+1
| | | | llvm-svn: 327350
* [llvm] Fix mc testsAlexander Shaposhnikov2018-03-121-0/+4
| | | | | | | This diff adjusts the mc tests after changing the format of llvm-readobj output for .group sections. llvm-svn: 327349
* [analyzer] Support temporaries conjured by conservatively evaluated functions.Artem Dergachev2018-03-123-17/+81
| | | | | | | | | | | | | | Properly perform destruction and lifetime extension of such temporaries. C++ object-type return values of conservatively evaluated functions are now represented as compound values of well-defined temporary object regions. The function creates a region that represents the temporary object and will later be used for destruction or materialization, invalidates it, and returns the invalidated compound value of the object. Differential Revision: https://reviews.llvm.org/D44131 llvm-svn: 327348
* [analyzer] NFC: Move the code for setting temp object lifetime into method.Artem Dergachev2018-03-123-61/+69
| | | | | | Differential Revision: https://reviews.llvm.org/D44129 llvm-svn: 327347
* Revert "Reland "[clang-doc] Setup clang-doc frontend framework""Julie Hockett2018-03-1224-2119/+0
| | | | | | | This reverts commit r327295 since it was causing the Windows bots to fail. llvm-svn: 327346
* [analyzer] Destroy and lifetime-extend inlined function return values properly.Artem Dergachev2018-03-122-29/+214
| | | | | | | | | | | | | | | This patch uses the newly added CFGCXXRecordTypedCall element at the call site of the caller to construct the return value within the callee directly into the caller's stack frame. This way it is also capable of populating the temporary destructor and lifetime extension maps for the temporary, which allows temporary destructors and lifetime extension to work correctly. This patch does not affect temporaries that were returned from conservatively evaluated functions. Differential Revision: https://reviews.llvm.org/D44124 llvm-svn: 327345
OpenPOWER on IntegriCloud