- May 12, 2020
-
-
Eric Christopher authored
new unhandled matrix types.
-
Zola Bridges authored
SLH doesn't support asm goto and is unlikely to ever support it. Users of asm goto need a way to choose whether to use asm goto or fallback to an SLH compatible code path when SLH is enabled. This feature flag will give users this ability. Tested via unit test Reviewed By: mattdr Differential Revision: https://reviews.llvm.org/D79733
-
Sanjay Patel authored
-
Johannes Doerfert authored
We will now ensure ensure the return type of called function is the type of all call sites we are going to rewrite. This avoids a problem partially fixed by D79680. The part that was not covered is a use of this "weird" casted call site (see `@func3` in `misc_crash.ll`). misc_crash.ll checks are auto-generated now.
-
Johannes Doerfert authored
We should never give up on AAIsDead as it guards other AAs from unreachable code (in which SSA properties are meaningless). We did however use required dependences on some queries in AAIsDead which caused us to invalidate AAIsDead if the queried AA got invalidated. We now use optional dependences instead. The bug that exposed this is added to the liveness.ll test and other test changes show the impact. Bug report by @sdmitriev.
-
Johannes Doerfert authored
During an update of AAIsDead, new instructions become live. If we query information from them, the result is often just the initial state, e.g., for call site `noreturn` and `nounwind`. We will now trigger an update for cached attributes during the AAIsDead update, though other AAs might later use the same API.
-
Tim Keith authored
When a module contained an import of a use-association of a use-association, we weren't recognizing that the symbols was needed. The fix is the follow all of the use-associations using `GetUltimate()`. Differential Revision: https://reviews.llvm.org/D79737
-
LLVM GN Syncbot authored
-
Scott Constable authored
After finding all such gadgets in a given function, the pass minimally inserts LFENCE instructions in such a manner that the following property is satisfied: for all SOURCE+SINK pairs, all paths in the CFG from SOURCE to SINK contain at least one LFENCE instruction. The algorithm that implements this minimal insertion is influenced by an academic paper that minimally inserts memory fences for high-performance concurrent programs: http://www.cs.ucr.edu/~lesani/companion/oopsla15/OOPSLA15.pdf The algorithm implemented in this pass is as follows: 1. Build a condensed CFG (i.e., a GadgetGraph) consisting only of the following components: -SOURCE instructions (also includes function arguments) -SINK instructions -Basic block entry points -Basic block terminators -LFENCE instructions 2. Analyze the GadgetGraph to determine which SOURCE+SINK pairs (i.e., gadgets) are already mitigated by existing LFENCEs. If all gadgets have been mitigated, go to step 6. 3. Use a heuristic or plugin to approximate minimal LFENCE insertion. 4. Insert one LFENCE along each CFG edge that was cut in step 3. 5. Go to step 2. 6. If any LFENCEs were inserted, return true from runOnFunction() to tell LLVM that the function was modified. By default, the heuristic used in Step 3 is a greedy heuristic that avoids inserting LFENCEs into loops unless absolutely necessary. There is also a CLI option to load a plugin that can provide even better optimization, inserting fewer fences, while still mitigating all of the LVI gadgets. The plugin can be found here: https://github.com/intel/lvi-llvm-optimization-plugin, and a description of the pass's behavior with the plugin can be found here: https://software.intel.com/security-software-guidance/insights/optimized-mitigation-approach-load-value-injection. Differential Revision: https://reviews.llvm.org/D75937
-
Scott Constable authored
Adds a new data structure, ImmutableGraph, and uses RDF to find LVI gadgets and add them to a MachineGadgetGraph. More specifically, a new X86 machine pass finds Load Value Injection (LVI) gadgets consisting of a load from memory (i.e., SOURCE), and any operation that may transmit the value loaded from memory over a covert channel, or use the value loaded from memory to determine a branch/call target (i.e., SINK). Also adds a new target feature to X86: +lvi-load-hardening The feature can be added via the clang CLI using -mlvi-hardening. Differential Revision: https://reviews.llvm.org/D75936
-
jasonliu authored
Fix build break in x86 platform which introduced by https://reviews.llvm.org/D79127
-
Arthur Eubanks authored
Summary: This fixes compiler-rt/test/msan/coverage-levels.cpp under the new pass manager (final check-msan test!). Under the old pass manager, the coverage pass would run before the MSan pass. The opposite happened under the new pass manager. The MSan pass adds extra basic blocks, changing the number of coverage callbacks. Reviewers: vitalybuka, leonardchan Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D79698
-
Sean Silva authored
Summary: - Mark it NoSideEffect - Add custom parser/printer Differential Revision: https://reviews.llvm.org/D79684
-
Sean Silva authored
Summary: This makes a common pattern of `dyn_cast_or_null<OpTy>(v.getDefiningOp())` more concise. Differential Revision: https://reviews.llvm.org/D79681
-
jasonliu authored
Summary: This patch tries to emit the correct alignment result for both object file generation path and assembly path. Reviewed by: hubert.reinterpretcast, DiggerLin, daltenty Differential Revision: https://reviews.llvm.org/D79127
-
Jez Ng authored
The initial attempt didn't work on Windows; apparently Powershell has a different syntax for running commands sequentially and concatenating their outputs. So I've created two temporary files instead. Differential Revision: https://reviews.llvm.org/D79697
-
Melanie Blower authored
This bug was observed by Apple since their compiler processes LangOpts and CGOpts in a different order. Reviewed By: rjmccall Differential Revision: https://reviews.llvm.org/D79735
-
Sanjay Patel authored
Follow-up to D79452. Mimics the extra use cost formula for the inverse transform with extracts.
-
Sanjay Patel authored
-
Joel E. Denny authored
Sometimes you want to disable a FileCheck directive without removing it entirely, or you want to write comments that mention a directive by name. The `COM:` directive makes it easy to do this. For example, you might have: ``` ; X32: pinsrd_1: ; X32: pinsrd $1, 4(%esp), %xmm0 ; COM: FIXME: X64 isn't working correctly yet for this part of codegen, but ; COM: X64 will have something similar to X32: ; COM: ; COM: X64: pinsrd_1: ; COM: X64: pinsrd $1, %edi, %xmm0 ``` Without this patch, you need to use some combination of rewording and directive syntax mangling to prevent FileCheck from recognizing the commented occurrences of `X32:` and `X64:` above as directives. Moreover, FileCheck diagnostics have been proposed that might complain about the occurrences of `X64` that don't have the trailing `:` because they look like directive typos: <http://lists.llvm.org/pipermail/llvm-dev/2020-April/140610.html> I think dodging all these problems can prove tedious for test authors, and directive syntax mangling already makes the purpose of existing test code unclear. `COM:` can avoid all these problems. This patch also updates the small set of existing tests that define `COM` as a check prefix: - clang/test/CodeGen/default-address-space.c - clang/test/CodeGenOpenCL/addr-space-struct-arg.cl - clang/test/Driver/hip-device-libs.hip - llvm/test/Assembler/drop-debug-info-nonzero-alloca.ll I think lit should support `COM:` as well. Perhaps `clang -verify` should too. Reviewed By: jhenderson, thopre Differential Revision: https://reviews.llvm.org/D79276
-
Joel E. Denny authored
This will prove especially helpful after D79276, which introduces comment prefixes. Specifically, identifying whether there's a uniqueness violation will be helpful as prefixes will be required to be unique across both check prefixes and comment prefixes. Also, remove a related comment about `cl::list` that no longer seems relevant now that FileCheck is also a library. Reviewed By: jhenderson, thopre Differential Revision: https://reviews.llvm.org/D79375
-
Joel E. Denny authored
D78566 introduced a `\bnot\b` lit substitution in OpenMP test suites. However, that would corrupt a command like `FileCheck -implicit-check-not` or any file name like `%t.not`. We could use lookbehind/lookahead assertions to avoid such cases, but this patch switches to `%not` (suggested during the D78566 review) as a safer option. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D79529
-
Tim Keith authored
There were several different ways of handling the option to f18 to find predefined modules: - test_errors.sh was created by cmake substituting FLANG_INTRINSIC_MODULES_DIR into test_errors.sh.in - some tests used the flang script which has the option built it - some tests used %f18_with_includes which was replaced by the path to f18 plus the -I option - some included -I../../include/flang in their run command To make this more consistent, change %f18 to include the -intrinsic-module-directory option and use it everywhere, including to replace %flang and %f18_with_includes. This requires changing all of the invocations of the test scripts to put %f18 at the end so that it can expand to more than one argument. This eliminates the need to generate test_errors.sh which means we don't need flang/test/Semantics/CMakeLists.txt or the %B substitution. That makes the test_errors.sh command like the others, replacing %B/test/Semantics/test_errors.sh with %S/test_errors.sh. Also remove the OPTIONS: functionality as custom options can be included in the RUN: command. And remove -I/../../include/flang as that is now always included. Differential Revision: https://reviews.llvm.org/D79634
-
Jessica Paquette authored
This fixes a couple verifier failures on this bot: http://green.lab.llvm.org/green/job/test-suite-verify-machineinstrs-aarch64-globalisel-O0-g/ The failures show up in eeprof-1.c and pr17377.c in the GCC C Torture Suite. Specifically: *** Bad machine code: MBB has allocatable live-in, but isn't entry or landing-pad. *** - function: foo - basic block: %bb.3 if.end (0x7fac7106dfc8) - p. register: $lr and *** Bad machine code: Using an undefined physical register *** - function: f - basic block: %bb.1 entry (0x7f8941092588) - instruction: %18:gpr64 = COPY $lr - operand 1: $lr Unlike SDAG, we were setting LR as a live in to the block containing the returnaddress. Also, this ensures that we don't add LR as a livein to the entry block twice. In MachineBasicBlock.h there's a comment saying "Note that it is an error to add the same register to the same set more than once unless the intention is to call sortUniqueLiveIns after all registers are added." so it's probably good to avoid adding LR twice. Surprisingly the verifier doesn't complain about that. Maybe it should. Differential Revision: https://reviews.llvm.org/D79657
-
Sam Elliott authored
Summary: RISC-V uses a post-select peephole pass to optimise `(load/store (ADDI $reg, %lo(addr)), 0)` into `(load/store $reg, %lo(addr))`. This peephole wasn't firing for accesses to constant pools, which is how we materialise most floating point constants. This adds support for the constantpool case, which improves code generation for lots of small FP loading examples. I have not added any tests because this structure is well-covered by the `fp-imm.ll` testcases, as well as almost all other uses of floating point constants in the RISC-V backend tests. Reviewed By: luismarques, asb Differential Revision: https://reviews.llvm.org/D79523
-
Florian Hahn authored
This patch adds a matrix type to Clang as described in the draft specification in clang/docs/MatrixSupport.rst. It introduces a new option -fenable-matrix, which can be used to enable the matrix support. The patch adds new MatrixType and DependentSizedMatrixType types along with the plumbing required. Loads of and stores to pointers to matrix values are lowered to memory operations on 1-D IR arrays. After loading, the loaded values are cast to a vector. This ensures matrix values use the alignment of the element type, instead of LLVM's large vector alignment. The operators and builtins described in the draft spec will will be added in follow-up patches. Reviewers: martong, rsmith, Bigcheese, anemet, dexonsmith, rjmccall, aaron.ballman Reviewed By: rjmccall Differential Revision: https://reviews.llvm.org/D72281
-
Nico Weber authored
-
Sanjay Patel authored
-
Valentin Clement authored
Summary: Flang was not compiling correctly after the renaming of Loop dialect to SCF. This patch fixes the problem. Reviewers: ftynse, DavidTruby Reviewed By: ftynse Subscribers: aartbik, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D79723
-
Sam Elliott authored
This reverts commit fe69dfeb, due to a slight change in the API.
-
Sean Fertile authored
Change an if else to use a conditional which is shorter. Also name the conditonal value to make the code clearer.
-
Thomas Lively authored
Summary: Although using `__builtin_shufflevector` and the `shufflevector` instruction works fine, they are not opaque to the optimizer. As a result, DAGCombine can potentially reduce the number of shuffles and change the shuffle masks. This is unexpected behavior for users of the WebAssembly SIMD intrinsics who have crafted their shuffles to optimize the code generated by engines. This patch solves the problem by adding a new shuffle intrinsic that is opaque to the optimizers in line with the decision of the WebAssembly SIMD contributors at https://github.com/WebAssembly/simd/issues/196#issuecomment-622494748. In the future we may implement custom DAG combines to properly optimize shuffles and replace this solution. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D66983
-
Sam Elliott authored
Summary: RISC-V uses a post-select peephole pass to optimise `(load/store (ADDI $reg, %lo(addr)), 0)` into `(load/store $reg, %lo(addr))`. This peephole wasn't firing for accesses to constant pools, which is how we materialise most floating point constants. This adds support for the constantpool case, which improves code generation for lots of small FP loading examples. I have not added any tests because this structure is well-covered by the `fp-imm.ll` testcases, as well as almost all other uses of floating point constants in the RISC-V backend tests. Reviewed By: luismarques, asb Differential Revision: https://reviews.llvm.org/D79523
-
Hongtao Yu authored
This patch addresses two issues related to adding inline functions to the import list while recursively going through the profiling data. 1. For callsite samples, only add an inlined function to the import list if it's from outside of the module (i.e. only has a declaration inside the module). 2. For body samples, add each target function to the import list if it's from outside of the module (i.e. only has a declaration inside the module). Previously we were using getSubProgram() to check whether it has dbg info, which is inaccurate. This fix properly add imports and could improve the quality of the pass. Added a few changes to the test to catch these cases. Differential Revision: https://reviews.llvm.org/D79379
-
Vedant Kumar authored
Summary: TestNSDictionarySynthetic sets up an NSURL which does not initialize its _baseURL member. When the test runs and we print out the NSURL, we print out some garbage memory pointed-to by the _baseURL member, like: ``` _baseURL = 0x0800010020004029 @"d��qX" ``` and this can cause a python unicode decoding error like: ``` UnicodeDecodeError: 'utf8' codec can't decode byte 0xa0 in position 10309: invalid start byte ``` There's a discrepancy here because lldb's StringPrinter facility tries to only print out "printable" sequences (see: isprint32()), whereas python rejects the StringPrinter output as invalid utf8. For the specific error seen above, lldb's `isprint32(0xa0) = true`, even though 0xa0 is not really "printable" in the usual sense. The problem is that lldb and python disagree on what exactly is "printable". Both have dismayingly hand-rolled utf8 validation code (c.f. _Py_DecodeUTF8Ex), and I can't really tell which one is more correct. I tried replacing lldb's isprint32() with a call to libc's iswprint(): this satisfied python, but broke emoji printing :|. Now, I believe that lldb (and python too) ought to just call into some battle-tested utf library, and that we shouldn't aim for compatibility with python's strict unicode decoding mode until then. FWIW I ran this test under an ASanified lldb hundreds of times but didn't turn up any other issues. rdar://62941711 Reviewers: JDevlieghere, jingham, shafik Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D79645
-
Julian Lettner authored
Create a sanitizer_ptrauth.h header that #includes <ptrauth> when available and defines just the required macros as "no ops" otherwise. This should avoid the need for excessive #ifdef'ing. Follow-up to and discussed in: https://reviews.llvm.org/D79132 Reviewed By: delcypher Differential Revision: https://reviews.llvm.org/D79540
-
LLVM GN Syncbot authored
-
Zola Bridges authored
This is an implementation of Speculative Execution Side Effect Suppression which is intended as a last resort mitigation against Load Value Injection, LVI, a newly disclosed speculative execution side channel vulnerability. One pager: https://software.intel.com/security-software-guidance/software-guidance/load-value-injection Deep dive: https://software.intel.com/security-software-guidance/insights/deep-dive-load-value-injection The mitigation consists of a compiler pass that inserts an LFENCE before each memory read instruction, memory write instruction, and the first branch instruction in a group of terminators at the end of a basic block. The goal is to prevent speculative execution, potentially based on misspeculated conditions and/or containing secret data, from leaking that data via side channels embedded in such instructions. This is something of a last-resort mitigation: it is expected to have extreme performance implications and it may not be a complete mitigation due to trying to enumerate side channels. In addition to the full version of the mitigation, this patch implements three flags to turn off part of the mitigation. These flags are disabled by default. The flags are not intended to result in a secure variant of the mitigation. The flags are intended to be used by users who would like to experiment with improving the performance of the mitigation. I ran benchmarks with each of these flags enabled in order to find if there was any room for further optimization of LFENCE placement with respect to LVI. Performance Testing Results When applying this mitigation to BoringSSL, we see the following results. These are a summary/aggregation of the performance changes when this mitigation is applied versus when no mitigation is applied. Fully Mitigated vs Baseline Geometric mean 0.071 (Note: This can be read as the ops/s of the mitigated program was 7.1% of the ops/s of the unmitigated program.) Minimum 0.041 Quartile 1 0.060 Median 0.063 Quartile 3 0.077 Maximum 0.230 Reviewed By: george.burgess.iv Differential Revision: https://reviews.llvm.org/D75939
-
Nicolas Vasilache authored
This [discussion](https://llvm.discourse.group/t/viewop-isnt-expressive-enough/991/2) raised some concerns with ViewOp. In particular, the handling of offsets is incorrect and does not match the op description. Note that with an elemental type change, offsets cannot be part of the type in general because sizeof(srcType) != sizeof(dstType). Howerver, offset is a poorly chosen term for this purpose and is renamed to byte_shift. Additionally, for all intended purposes, trying to support non-identity layouts for this op does not bring expressive power but rather increases code complexity. This revision simplifies the existing semantics and implementation. This simplification effort is voluntarily restrictive and acts as a stepping stone towards supporting richer semantics: treat the non-common cases as YAGNI for now and reevaluate based on concrete use cases once a round of simplification occurred. Differential revision: https://reviews.llvm.org/D79541
-
Zola Bridges authored
Summary: These tools are no longer useful since we've migrated off of SVN, so this patch deletes them. RFC Link: http://lists.llvm.org/pipermail/llvm-dev/2020-May/141386.html Unless there is opposition in the RFC thread, I'll submit the patch on May 10, 2020. I searched through the repo to confirm there were no mentions of the scripts in other scripts or documentation. Reviewed By: echristo, tstellar, MaskRay Differential Revision: https://reviews.llvm.org/D79348
-