summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* [X86] Remove X86ISD::INC/DEC. Just select them from X86ISD::ADD/SUB at isel timeCraig Topper2019-01-028-210/+178
| | | | | | | | | | | | | | INC/DEC are pretty much the same as ADD/SUB except that they don't update the C flag. This patch removes the special nodes and just pattern matches from ADD/SUB during isel if the C flag isn't being used. I had to avoid selecting DEC is the result isn't used. This will become a SUB immediate which will turned into a CMP later by optimizeCompareInstr. This lead to the one test change where we use a CMP instead of a DEC for an overflow intrinsic since we only checked the flag. This also exposed a hole in our RMW flag matching use of hasNoCarryFlagUses. Our root node for the match is a store and there's no guarantee that all the flag users have been selected yet. So hasNoCarryFlagUses needs to check copyToReg and machine opcodes, but it also needs to check for the pre-match SETCC, SETCC_CARRY, BRCOND, and CMOV opcodes. Differential Revision: https://reviews.llvm.org/D55975 llvm-svn: 350245
* Use map::insert instead of try_emplace.Zachary Turner2019-01-021-1/+1
| | | | | | try_emplace is C++17. llvm-svn: 350244
* [NativePDB] Implement ParseDeclsForContext.Zachary Turner2019-01-027-51/+443
| | | | | | | | | | | This is a first step towards getting lldb-test symbols working with the native plugin. There is a remaining issue, which is that the plugin expects that ParseDeclsForContext will also create lldb symbols rather than just the decls, but the native pdb plugin doesn't currently do this. This will be addressed in a followup patch. llvm-svn: 350243
* [NativePDB] Update function-types-classes test to check VarDecls.Zachary Turner2019-01-021-3/+13
| | | | | | | | A Previous patch added support for creating VarDecls for global variables. This patch updates this test to be more strict and actually check these, not just the types. llvm-svn: 350242
* [MS Demangler] Add a flag for dumping types without tag specifier.Zachary Turner2019-01-022-9/+12
| | | | | | | | Sometimes it's useful to be able to output demangled names without tag specifiers like "struct", "class", etc. This patch adds a flag enabling this. llvm-svn: 350241
* [NativePDB] Fix setting breakpoint by file and line.Zachary Turner2019-01-027-18/+70
| | | | | | | | | | | | | | | | | | | There were several problems preventing this from working. The first is that when the PDB had an absolute path to the main source file, we would construct an invalid path by prepending the compilation directory to it anyway. So we needed to check if the path is already absolute first. Second, LLDB assumes that the zero'th item in the support file list is the main compilation unit. We were respecting this requirement, but LLDB *also* requires that file to appear somewhere in the list starting from index 1 as well. So the main compilation file should appear in the support file list twice. And when parsing a line table, it expects the LineEntry records to be constructed using the 1-based index. With these two fixes we can now set breakpoints by file and line using the native PDB reader. llvm-svn: 350240
* [DAGCombiner] After performing the division by constant optimization for a ↵Craig Topper2019-01-023-17/+41
| | | | | | | | | | | | DIV or REM node, replace the users of the corresponding REM or DIV node if it exists. Currently we expand the two nodes separately. This gives DAG combiner an opportunity to optimize the expanded sequence taking into account only one set of users. When we expand the other node we'll create the expansion again, but might not be able to optimize it the same way. So the nodes won't CSE and we'll have two similarish sequences in the same basic block. By expanding both nodes at the same time we'll avoid prematurely optimizing the expansion until both the division and remainder have been replaced. Improves the test case from PR38217. There may be additional opportunities after this. Differential Revision: https://reviews.llvm.org/D56145 llvm-svn: 350239
* [gn build] Add fuzzers in llvm/tools that are needed for check-llvmNico Weber2019-01-027-3/+128
| | | | | | | | | | | | Also add a fuzzer() template for defining fuzzers that's similar to add_llvm_fuzzer in the CMake build, and a build file for dependency llvm/lib/FuzzMutate. Also make `assert(defined(...` error strings a bit more self-consistent. Differential Revision: https://reviews.llvm.org/D56194 llvm-svn: 350238
* [X86] Adding full coverage of MC encoding for the XOP and LWP ISAs.Craig Topper2019-01-024-0/+6946
| | | | | | | | | Adding MC regressions tests to cover the XOP isa set. This patch is part of a larger task to cover MC encoding of all X86 isa sets started in revision: https://reviews.llvm.org/D39952 Differential Revision: https://reviews.llvm.org/D41392 llvm-svn: 350237
* [LegalizeIntegerTypes] When promoting the result of an extract_vector_elt ↵Craig Topper2019-01-022-38/+47
| | | | | | | | | | | | | | also promote the input type if necessary By also promoting the input type we get a better idea for what scalar type to use. This can provide better results if the result of the extract is sign extended. What was previously happening is that the extract result would be legalized, sometime later the input of the sign extend would be legalized using the result of the extract. Then later the extract input would be legalized forcing a truncate into the input of the sign extend using a replace all uses. This requires DAG combine to combine out the sext/truncate pair. But sometimes we visited the truncate first and messed things up before the sext could be combined. By creating the extract with the correct scalar type when we create legalize the result type, the truncate will be added right away. Then when the sign_extend input is legalized it will create an any_extend of the truncate which can be optimized by getNode to maybe remove the truncate. And then a sign_extend_inreg. Now DAG combine doesn't have to worry about getting rid of the extend. This fixes the regression on X86 in D56156. Differential Revision: https://reviews.llvm.org/D56176 llvm-svn: 350236
* [DAGCombiner][X86][PowerPC] Teach visitSIGN_EXTEND_INREG to fold ↵Craig Topper2019-01-025-49/+56
| | | | | | | | | | | | (sext_in_reg (aext/sext x)) -> (sext x) when x has more than 1 sign bit and the sext_inreg is from one of them. If x has multiple sign bits than it doesn't matter which one we extend from so we can sext from x's msb instead. The X86 setcc-combine.ll changes are a little weird. It appears we ended up with a (sext_inreg (aext (trunc (extractelt)))) after type legalization. The sext_inreg+aext now gets optimized by this combine to leave (sext (trunc (extractelt))). Then we visit the trunc before we visit the sext. This ends up changing the truncate to an extractvectorelt from a bitcasted vector. I have a follow up patch to fix this. Differential Revision: https://reviews.llvm.org/D56156 llvm-svn: 350235
* [gn build] Add build files for bugpoint-passes and LLVMHello pluginsNico Weber2019-01-025-8/+70
| | | | | | | | | | | | These two plugins are loaded into a host process that contains all LLVM symbols, so they don't link against anything. This required minor readjustments to the tablegen() setup of IR. Needed for check-llvm. Differential Revision: https://reviews.llvm.org/D56204 llvm-svn: 350234
* [sanitizer_common] Implement funopen*() interceptors for NetBSDMichal Gorny2019-01-022-0/+164
| | | | | | Differential Revision: https://reviews.llvm.org/D56158 llvm-svn: 350233
* [sanitizer_common] Implement popen, popenve, pclose interceptorsMichal Gorny2019-01-023-1/+80
| | | | | | | | | | | | | | | Implement the interceptors for popen(), pclose() and popenve() functions. The first two are POSIX, the third one is specific to NetBSD. popen() spawns a process and creates a FILE object piping data from/to that process. pclose() closes the pipe and waits for the process to terminate appropriately. For the purpose of popen(), the COMMON_INTERCEPTOR_FILE_OPEN macro is modified to allow null path parameter. Differential Revision: https://reviews.llvm.org/D56157 llvm-svn: 350232
* [sanitizer_common] Add tests for NetBSD funopen*() functionsMichal Gorny2019-01-022-0/+199
| | | | | | Differential Revision: https://reviews.llvm.org/D56154 llvm-svn: 350231
* [sanitizer_common] Add test for popen()Michal Gorny2019-01-021-0/+23
| | | | | | Differential Revision: https://reviews.llvm.org/D56153 llvm-svn: 350230
* [sanitizer_common] Add tests for more *putc and *getc variantsMichal Gorny2019-01-023-0/+45
| | | | | | | | | | | Add tests for the more character-oriented functions, that is: - fputc(), putc() and putchar() - getc_unlocked() - putc_unlocked() and putchar_unlocked() Differential Revision: https://reviews.llvm.org/D56152 llvm-svn: 350229
* [sanitizer_common] Fix devname_r() return type on !NetBSDMichal Gorny2019-01-021-4/+11
| | | | | | | | | | Update the interceptor for devname_r() to account for correct return types on different platforms. This function returns int on NetBSD but char* on FreeBSD/OSX. Noticed by @krytarowski. Differential Revision: https://reviews.llvm.org/D56150 llvm-svn: 350228
* [sanitizer_common] Rewrite more Posix tests to use assertsMichal Gorny2019-01-026-46/+26
| | | | | | | | | | Rewrite the tests for Posix functions that silently 'return 1' or 'exit(1)' on error, to instead verbosely report the error using assert. This is based on requests made in review of D56136. Differential Revision: https://reviews.llvm.org/D56149 llvm-svn: 350227
* [gn build] Add some llvm/tools: lli, lli-child-targetNico Weber2019-01-025-0/+89
| | | | | | | | | | Also add build files for dependencies llvm/lib/ExecutionEngine/{Interpreter,Orc} Needed for check-llvm. Differential Revision: https://reviews.llvm.org/D56193 llvm-svn: 350226
* [sanitizer_common] Add tests for more stdio.h functionsMichal Gorny2019-01-022-0/+60
| | | | | | | | | | | | | | | Add two new test cases that test the following stdio.h functions: - clearerr() - feof() - ferror() - fileno() - fgetc() - getc() - ungetc() Differential Revision: https://reviews.llvm.org/D56136 llvm-svn: 350225
* Only convert objc messages to alloc to objc_alloc if the receiver is a class.Pete Cooper2019-01-022-4/+22
| | | | | | | | | | r348687 converted [Foo alloc] to objc_alloc(Foo). However the objc runtime method only takes a Class, not an arbitrary pointer. This makes sure we are messaging a class before we convert these messages. rdar://problem/46943703 llvm-svn: 350224
* [PowerPC] Remove SeenUse check when optimizing conditional branch inWei Mi2019-01-022-1/+109
| | | | | | | | | | | | | | | | | | | | | | PPCPreEmitPeephole pass. PPCPreEmitPeephole will convert a BC to B when the conditional branch is based on a constant CR by CRSET or CRUNSET. This is added in https://reviews.llvm.org/rL343100. When the conditional branch is known to be always taken, all branches will be removed and a new unconditional branch will be inserted. However, when SeenUse is false the original patch will not remove the branches, but still insert the new unconditional branch, update the successors and create inconsistent IR. Compiling the synthetic testcase included can show the problem we run into. The patch simply removes the SeenUse condition when adding branches into InstrsToErase set. Differential Revision: https://reviews.llvm.org/D56041 llvm-svn: 350223
* [X86] Support SHLD/SHRD masked shift-counts (PR34641)Simon Pilgrim2019-01-022-28/+37
| | | | | | | | | | Peek through shift modulo masks while matching double shift patterns. I was hoping to delay this until I could remove the X86 code with generic funnel shift matching (PR40081) but this will do for now. Differential Revision: https://reviews.llvm.org/D56199 llvm-svn: 350222
* [x86] add more tests for potential horizontal ops; NFCSanjay Patel2019-01-021-89/+325
| | | | | | As discussed in D56011 - add runs for AVX512 and tests with extra uses. llvm-svn: 350221
* [BasicAA] Support arbitrary pointer sizes (and fix an overflow bug)Hal Finkel2019-01-027-53/+220
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Motivated by the discussion in D38499, this patch updates BasicAA to support arbitrary pointer sizes by switching most remaining non-APInt calculations to use APInt. The size of these APInts is set to the maximum pointer size (maximum over all address spaces described by the data layout string). Most of this translation is straightforward, but this patch contains a fix for a bug that revealed itself during this translation process. In order for test/Analysis/BasicAA/gep-and-alias.ll to pass, which is run with 32-bit pointers, the intermediate calculations must be performed using 64-bit integers. This is because, as noted in the patch, when GetLinearExpression decomposes an expression into C1*V+C2, and we then multiply this by Scale, and distribute, to get (C1*Scale)*V + C2*Scale, it can be the case that, even through C1*V+C2 does not overflow for relevant values of V, (C2*Scale) can overflow. If this happens, later logic will draw invalid conclusions from the (base) offset value. Thus, when initially applying the APInt conversion, because the maximum pointer size in this test is 32 bits, it started failing. Suspicious, I created a 64-bit version of this test (included here), and that failed (miscompiled) on trunk for a similar reason (the multiplication can overflow). After fixing this overflow bug, the first test case (at least) in Analysis/BasicAA/q.bad.ll started failing. This is also a 32-bit test, and was relying on having 64-bit intermediate values to have BasicAA return an accurate result. In order to fix this problem, and because I believe that it is not uncommon to use i64 indexing expressions in 32-bit code (especially portable code using int64_t), it seems reasonable to always use at least 64-bit integers. In this way, we won't regress our analysis capabilities (and there's a command-line option added, so experimenting with this should be easy). As pointed out by Eli during the review, there are other potential overflow conditions that this patch does not address. Fixing those is left to follow-up work. Patch by me with contributions from Michael Ferguson (mferguson@cray.com). Differential Revision: https://reviews.llvm.org/D38662 llvm-svn: 350220
* Extend Module::getOrInsertGlobal to control the construction of thePhilip Pfaffe2019-01-022-13/+23
| | | | | | | | | | | | | | | | | | GlobalVariable Summary: Extend Module::getOrInsertGlobal to accept a callback for creating a new GlobalVariable if necessary instead of calling the GV constructor directly using default arguments. Additionally overload getOrInsertGlobal for the previous default behavior. Reviewers: chandlerc Subscribers: hiraditya, llvm-commits, bollu Differential Revision: https://reviews.llvm.org/D56130 llvm-svn: 350219
* [MCA] Minor refactoring of method DefaultResourceStrategy::select. NFCIAndrea Di Biagio2019-01-021-18/+21
| | | | | | | | | | | | | | | | | Common code used by the default resource strategy to select pipeline resources has been moved to an helper function. The new selection logic has been slightly rewritten to get rid of a redundant zero check on the `ReadyMask` value. Before this patch, method select internally called function `PowerOf2Floor` to compute the next ready pipeline resource. However, `PowerOf2Floor` forces an implicit (redundant) zero check on the input value. By construction, `ReadyMask` can never be zero. This patch replaces the call to `PowerOf2Floor` with an equivalent block of code which avoids the redundant zero check. This gives a minor 3-3.5% speedup on a release build. No functional change intended. llvm-svn: 350218
* [gn build] Add some llvm/tools: bugpoint, dsymutil, llvm-opt-reportNico Weber2019-01-025-0/+93
| | | | | | | | | | Also add build file for dependency llvm/lib/OptRemarks. Needed for check-llvm. Differential Revision: https://reviews.llvm.org/D56192 llvm-svn: 350217
* [gn build] Add some llvm/tools: llvm-c-test, llvm-cfi-verify, llvm-cov, ↵Nico Weber2019-01-026-0/+114
| | | | | | | | | | llvm-cvtres Needed for check-llvm. Differential Revision: https://reviews.llvm.org/D56191 llvm-svn: 350216
* [gn build] Add some llvm/tools: llvm-cxxdump, llvm-cxxfilt, llvm-cxxmapNico Weber2019-01-024-0/+61
| | | | | | | | | | Needed for check-llvm. This is the last target reading llvm_install_binutils_symlinks. Differential Revision: https://reviews.llvm.org/D56190 llvm-svn: 350215
* [gn build] Add some llvm/tools: llvm-diff, llvm-dwpNico Weber2019-01-023-0/+58
| | | | | | | | Needed for check-llvm. Differential Revision: https://reviews.llvm.org/D56189 llvm-svn: 350214
* [gn build] Add some llvm/tools: llvm-mca, llvm-mtNico Weber2019-01-024-0/+81
| | | | | | | | | | Also add build file for dependency llvm/lib/MCA. Needed for check-llvm. Differential Revision: https://reviews.llvm.org/D56166 llvm-svn: 350213
* [gn build] Add some llvm/tools: llvm-size, llvm-split, llvm-stringsNico Weber2019-01-024-0/+90
| | | | | | | | Needed for check-llvm. Differential Revision: https://reviews.llvm.org/D56164 llvm-svn: 350212
* [gn build] Add some llvm/tools: llvm-xray, sancov, sanstats, ↵Nico Weber2019-01-027-0/+99
| | | | | | | | | | | | | | verify-uselistorder, yaml-bench Also add build file for dependency llvm/lib/XRay. Needed for check-llvm. (yaml-bench is an llvm/util, not an llvm/tool.) Differential Revision: https://reviews.llvm.org/D56163 llvm-svn: 350211
* [clangd] Show FileStatus in vscode-clangd.Haojian Wu2019-01-021-0/+37
| | | | | | | | | | | | | | Summary: The file status will be shown in the status bar. Depends on D55363. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D55374 llvm-svn: 350210
* NativeProcessProtocolTest: fix -Winconsistent-missing-override warningPavel Labath2019-01-021-4/+7
| | | | | | | | The warning comes from the fact that the MOCK_METHOD macros don't use the override keyword internally. This makes us not use it in the manually overriden methods either, to be consistent. llvm-svn: 350209
* [AMDGPU] Handle OR as operand of raw load/storePiotr Sobczak2019-01-023-12/+94
| | | | | | | | | | | | | | | | | | Summary: Use isBaseWithConstantOffset() which handles OR as an operand to llvm.amdgcn.raw.buffer.load and llvm.amdgcn.raw.buffer.store. Change-Id: Ifefb9dc5ded8710d333df07ab1900b230e33539a Reviewers: nhaehnle, mareko, arsenm Reviewed By: arsenm Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits Differential Revision: https://reviews.llvm.org/D55999 llvm-svn: 350208
* Revert rL350035 "[llvm-exegesis] Clustering: don't enqueue a point multiple ↵Clement Courbet2019-01-021-35/+33
| | | | | | | | times" Let's discuss this on the review thread before submitting. llvm-svn: 350207
* [X86] Remove the separate SMUL8/UMUL8 X86ISD opcodes by merging with ↵Craig Topper2019-01-023-47/+25
| | | | | | | | SMUL/UMUL. Remove the second result from X86ISD::UMUL. All of these use custom isel so we can pretty easily detect the differences in the custom code in X86ISelDAGToDAG. The ISD opcodes just need to express the desired semantics not the details of how they would be selected by isel. So unifying them lets us remove the special casing from lowering. llvm-svn: 350206
* [X86] Allow LowerSELECT and LowerBRCOND to directly lower i8 UMULO/SMULO.Craig Topper2019-01-021-4/+2
| | | | | | | | These require a different X86ISD node to be created than i16/i32/i64. I guess no one wanted to add the special code for that except in LowerXALUO. But now LowerXALUO, LowerSELECT, and LowerBRCOND all use a common helper function so they all share the special code. Unfortunately, there are no test changes because we seem to correct the miss in a DAG combine later. I did verify it manually using test cases from xmulo.ll llvm-svn: 350205
* [X86] Add i8/i16 smulo/umulo test cases where the overflow indication is ↵Craig Topper2019-01-021-16/+188
| | | | | | used by a mask. llvm-svn: 350204
* [X86] Remove KNL specific check prefix from xmulo.ll test. NFCCraig Topper2019-01-021-184/+1
| | | | | | This was added at a time when i1 was a legal type with avx512f and there was a bug. i1 is no longer considered a legal type with avx512f so there should be no codegen difference. llvm-svn: 350203
* [CMake][Fuchsia] Include check-lld in the list of bootstrap targetsPetr Hosek2019-01-021-0/+3
| | | | | | | | This allows running lld tests when doing 2-stage toolchain build. Differential Revision: https://reviews.llvm.org/D56181 llvm-svn: 350202
* [InstCombine] canonicalize raw IR rotate patterns to funnel shiftSanjay Patel2019-01-013-43/+16
| | | | | | | | | | | | | | | The final piece of IR-level analysis to allow this was committed with: rL350188 Using the intrinsics should improve transforms based on cost models like vectorization and inlining. The backend should be prepared too, so we can now canonicalize more sequences of shift/logic to the intrinsics and know that the end result should be equal or better to the original code even if the target does not have an actual rotate instruction. llvm-svn: 350199
* [X86] Factor the core code out of LowerXALUO into a helper function. Use it ↵Craig Topper2019-01-012-148/+101
| | | | | | | | | | | | in LowerBRCOND and LowerSELECT to avoid some duplicated code. This makes it easier to keep the LowerBRCOND and LowerSELECT code in sync with LowerXALUO so they always pick the same operation for overflowing instructions. This is inspired by the helper functions used by ARM and AArch64 for the same purpose. The test change is because LowerSELECT was not in sync with LowerXALUO with regard to INC/DEC for SADDO/SSUBO. llvm-svn: 350198
* [LLVM-C] bool -> LLVMBoolRobert Widmann2019-01-012-4/+4
| | | | llvm-svn: 350197
* [LLVM-C] Add Accessors for Discarding Value Names in the IRRobert Widmann2019-01-012-0/+25
| | | | | | | | | | | | | | Summary: Add accessors so the performance improvement from this setting is accessible to third parties. Reviewers: whitequark, deadalnix Reviewed By: whitequark Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D56179 llvm-svn: 350196
* [X86] Remove KNL specific check prefix from xaluo.ll test. NFCCraig Topper2019-01-011-349/+1
| | | | | | This was added at a time when i1 was a legal type with avx512f and there was a bug. i1 is no longer considered a legal type with avx512f so there should be no codegen difference. llvm-svn: 350195
* [X86] Add test cases to show where LowerSELECT doesn't select SADDO/SSUBO to ↵Craig Topper2019-01-011-0/+79
| | | | | | | | INC/DEC, but LowerXALUOOp does. Leading to duplicate code. When SADDO/SSUBO is used as a part of a condition, the X86 backend has to lower the instruction twice. One for the flags use and then once for the data use. These two selections should be kept in sync so they end up with one node providing the data and the flags. This doesn't seem to be happening for INC/DEC. llvm-svn: 350194
OpenPOWER on IntegriCloud