1. Nov 08, 2019
    • Jeremy Morse's avatar
      Revert "[clang] Report sanitizer blacklist as a dependency in cc1" · 6b45e1bc
      Jeremy Morse authored
      This reverts commit 03b84e4f.
      
      This breaks dfsan tests with a linking failure, in for example this build:
      
        http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/24312
      
      Reverting this patch locally makes those tests succeed.
      6b45e1bc
    • Jeremy Morse's avatar
      Revert "[compiler-rt] Fix tests after 03b84e4f" · d6be9273
      Jeremy Morse authored
      This reverts commit bdeb2724.
      
      (Reverting 03b84e4f, so this must come out as well)
      d6be9273
    • Djordje Todorovic's avatar
      Reland: [TII] Use optional destination and source pair as a return value; NFC · 8d2ccd1a
      Djordje Todorovic authored
      Refactor usage of isCopyInstrImpl, isCopyInstr and isAddImmediate methods
      to return optional machine operand pair of destination and source
      registers.
      
      Patch by Nikola Prica
      
      Differential Revision: https://reviews.llvm.org/D69622
      8d2ccd1a
    • Raphael Isemann's avatar
      [lldb] Make Target* a Target& in CommandObjectExpression::DoExecute REPL logic · 5a1bac4d
      Raphael Isemann authored
      Subscribers: JDevlieghere, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D70002
      5a1bac4d
    • Raphael Isemann's avatar
      [lldb][NFC] Refactor some IsClangType checks in ClangASTContext · 79b3cce7
      Raphael Isemann authored
      Summary:
      All type in these functions need be valid and Clang types, so
      we might as well replace these checks with IsClangType.
      
      Also lets IsClangType explicitly check for validity instead of
      assuming that the TypeSystem is a nullptr.
      
      Subscribers: abidh, JDevlieghere, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D70001
      79b3cce7
    • Russell Gallop's avatar
      [cmake] Enable thin lto cache when building with lld-link · 0a8bd77e
      Russell Gallop authored
      This was enabled for other platforms. Added option for Windows/lld-link.
      
      Differential Revision: https://reviews.llvm.org/D69941
      0a8bd77e
    • Hans Wennborg's avatar
      Revert d91ed80e "[codeview] Reference types in type parent scopes" · ff3b5134
      Hans Wennborg authored
      This triggered asserts in the Chromium build, see https://crbug.com/1022729 for
      details and reproducer.
      
      > Without this change, when a nested tag type of any kind (enum, class,
      > struct, union) is used as a variable type, it is emitted without
      > emitting the parent type. In CodeView, parent types point to their inner
      > types, and inner types do not point back to their parents. We already
      > walk over all of the parent scopes to build the fully qualified name.
      > This change simply requests their type indices as we go along to enusre
      > they are all emitted.
      >
      > Fixes PR43905
      >
      > Reviewers: akhuang, amccarth
      >
      > Differential Revision: https://reviews.llvm.org/D69924
      ff3b5134
    • Sanne Wouda's avatar
      [RAGreedy] Enable -consider-local-interval-cost for AArch64 · f649f24d
      Sanne Wouda authored
      Summary:
      The greedy register allocator occasionally decides to insert a large number of
      unnecessary copies, see below for an example.  The -consider-local-interval-cost
      option (which X86 already enables by default) fixes this.  We enable this option
      for AArch64 only after receiving feedback that this change is not beneficial for
      PowerPC.
      
      We evaluated the impact of this change on compile time, code size and
      performance benchmarks.
      
      This option has a small impact on compile time, measured on CTMark. A 0.1%
      geomean regression on -O1 and -O2, and 0.2% geomean for -O3, with at most 0.5%
      on individual benchmarks.
      
      The effect on both code size and performance on AArch64 for the LLVM test suite
      is nil on the geomean with individual outliers (ignoring short exec_times)
      between:
      
                       best     worst
        size..text     -3.3%    +0.0%
        exec_time      -5.8%    +2.3%
      
      On SPEC CPU® 2017 (compiled for AArch64) there is a minor reduction (-0.2% at
      most) in code size on some benchmarks, with a tiny movement (-0.01%) on the
      geomean.  Neither intrate nor fprate show any change in performance.
      
      This patch makes the following changes.
      
      - For the AArch64 target, enableAdvancedRASplitCost() now returns true.
      
      - Ensures that -consider-local-interval-cost=false can disable the new
        behaviour if necessary.
      
      This matrix multiply example:
      
         $ cat test.c
         long A[8][8];
         long B[8][8];
         long C[8][8];
      
         void run_test() {
           for (int k = 0; k < 8; k++) {
             for (int i = 0; i < 8; i++) {
      	 for (int j = 0; j < 8; j++) {
      	   C[i][j] += A[i][k] * B[k][j];
      	 }
             }
           }
         }
      
      results in the following generated code on AArch64:
      
        $ clang --target=aarch64-arm-none-eabi -O3 -S test.c -o -
        [...]
                                              // %for.cond1.preheader
                                              // =>This Inner Loop Header: Depth=1
              add     x14, x11, x9
              str     q0, [sp, #16]           // 16-byte Folded Spill
              ldr     q0, [x14]
              mov     v2.16b, v15.16b
              mov     v15.16b, v14.16b
              mov     v14.16b, v13.16b
              mov     v13.16b, v12.16b
              mov     v12.16b, v11.16b
              mov     v11.16b, v10.16b
              mov     v10.16b, v9.16b
              mov     v9.16b, v8.16b
              mov     v8.16b, v31.16b
              mov     v31.16b, v30.16b
              mov     v30.16b, v29.16b
              mov     v29.16b, v28.16b
              mov     v28.16b, v27.16b
              mov     v27.16b, v26.16b
              mov     v26.16b, v25.16b
              mov     v25.16b, v24.16b
              mov     v24.16b, v23.16b
              mov     v23.16b, v22.16b
              mov     v22.16b, v21.16b
              mov     v21.16b, v20.16b
              mov     v20.16b, v19.16b
              mov     v19.16b, v18.16b
              mov     v18.16b, v17.16b
              mov     v17.16b, v16.16b
              mov     v16.16b, v7.16b
              mov     v7.16b, v6.16b
              mov     v6.16b, v5.16b
              mov     v5.16b, v4.16b
              mov     v4.16b, v3.16b
              mov     v3.16b, v1.16b
              mov     x12, v0.d[1]
              fmov    x15, d0
              ldp     q1, q0, [x14, #16]
              ldur    x1, [x10, #-256]
              ldur    x2, [x10, #-192]
              add     x9, x9, #64             // =64
              mov     x13, v1.d[1]
              fmov    x16, d1
              ldr     q1, [x14, #48]
              mul     x3, x15, x1
              mov     x14, v0.d[1]
              fmov    x17, d0
              mov     x18, v1.d[1]
              fmov    x0, d1
              mov     v1.16b, v3.16b
              mov     v3.16b, v4.16b
              mov     v4.16b, v5.16b
              mov     v5.16b, v6.16b
              mov     v6.16b, v7.16b
              mov     v7.16b, v16.16b
              mov     v16.16b, v17.16b
              mov     v17.16b, v18.16b
              mov     v18.16b, v19.16b
              mov     v19.16b, v20.16b
              mov     v20.16b, v21.16b
              mov     v21.16b, v22.16b
              mov     v22.16b, v23.16b
              mov     v23.16b, v24.16b
              mov     v24.16b, v25.16b
              mov     v25.16b, v26.16b
              mov     v26.16b, v27.16b
              mov     v27.16b, v28.16b
              mov     v28.16b, v29.16b
              mov     v29.16b, v30.16b
              mov     v30.16b, v31.16b
              mov     v31.16b, v8.16b
              mov     v8.16b, v9.16b
              mov     v9.16b, v10.16b
              mov     v10.16b, v11.16b
              mov     v11.16b, v12.16b
              mov     v12.16b, v13.16b
              mov     v13.16b, v14.16b
              mov     v14.16b, v15.16b
              mov     v15.16b, v2.16b
              ldr     q2, [sp]                // 16-byte Folded Reload
              fmov    d0, x3
              mul     x3, x12, x1
        [...]
      
      With -consider-local-interval-cost the same section of code results in the
      following:
      
        $ clang --target=aarch64-arm-none-eabi -mllvm -consider-local-interval-cost -O3 -S test.c -o -
        [...]
        .LBB0_1:                              // %for.cond1.preheader
                                              // =>This Inner Loop Header: Depth=1
              add     x14, x11, x9
              ldp     q0, q1, [x14]
              ldur    x1, [x10, #-256]
              ldur    x2, [x10, #-192]
              add     x9, x9, #64             // =64
              mov     x12, v0.d[1]
              fmov    x15, d0
              mov     x13, v1.d[1]
              fmov    x16, d1
              ldp     q0, q1, [x14, #32]
              mul     x3, x15, x1
              cmp     x9, #512                // =512
              mov     x14, v0.d[1]
              fmov    x17, d0
              fmov    d0, x3
              mul     x3, x12, x1
        [...]
      
      Reviewers: SjoerdMeijer, samparker, dmgreen, qcolombet
      
      Reviewed By: dmgreen
      
      Subscribers: ZhangKang, jsji, wuzish, ppc-slack, lkail, steven.zhang, MatzeB, qcolombet, kristof.beyls, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D69437
      f649f24d
    • Rui Ueyama's avatar
      Keep symbols passed by -init and -fini · f95273f7
      Rui Ueyama authored
      Previously, symbols passed by -init and -fini look as if they are
      not referenced by anyone, and the LTO might eliminate them.
      This patch fixes the issue.
      
      Fixes a bug reported in https://bugs.llvm.org/show_bug.cgi?id=43927
      
      Differential Revision: https://reviews.llvm.org/D69985
      f95273f7
    • Roger Ferrer Ibanez's avatar
      [RISCV] Fix evaluation of %pcrel_lo · 41449c58
      Roger Ferrer Ibanez authored
      The following testcase
      
        function:
        .Lpcrel_label1:
        	auipc	a0, %pcrel_hi(other_function)
        	addi	a1, a0, %pcrel_lo(.Lpcrel_label1)
        	.p2align	2          # Causes a new fragment to be emitted
      
        	.type	other_function,@function
        other_function:
        	ret
      
      exposes an odd behaviour in which only the %pcrel_hi relocation is
      evaluated but not the %pcrel_lo.
      
        $ llvm-mc -triple riscv64 -filetype obj t.s | llvm-objdump  -d -r -
      
        <stdin>:	file format ELF64-riscv
      
        Disassembly of section .text:
        0000000000000000 function:
               0:	17 05 00 00	auipc	a0, 0
               4:	93 05 05 00	mv	a1, a0
        		0000000000000004:  R_RISCV_PCREL_LO12_I	other_function+4
      
        0000000000000008 other_function:
               8:	67 80 00 00	ret
      
      The reason seems to be that in RISCVAsmBackend::shouldForceRelocation we
      only consider the fragment but in RISCVMCExpr::evaluatePCRelLo we
      consider the section. This usually works but there are cases where the
      section may still be the same but the fragment may be another one. In
      that case we end forcing a %pcrel_lo relocation without any %pcrel_hi.
      
      This patch makes RISCVAsmBackend::shouldForceRelocation use the section,
      if any, to determine if the relocation must be forced or not.
      
      Differential Revision: https://reviews.llvm.org/D60657
      41449c58
    • Adam Balogh's avatar
      [Analyzer] Checker for Debugging Iterator Checkers · 0f88caee
      Adam Balogh authored
      For white-box testing correct container and iterator modelling it is essential
      to access the internal data structures stored for container and iterators. This
      patch introduces a simple debug checkers called debug.IteratorDebugging to
      achieve this.
      
      Differential Revision: https://reviews.llvm.org/D67156
      0f88caee
    • Daniil Suchkov's avatar
      [NFC][IndVarS] Adjust a comment · 7b9f5401
      Daniil Suchkov authored
      (test commit)
      7b9f5401
    • Roman Lebedev's avatar
      [CR] ConstantRange::sshl_sat(): check sigdness of the min/max, not ranges · 72a21ad6
      Roman Lebedev authored
      This was pointed out in review,
      but forgot to stage this change into the commit itself..
      72a21ad6
    • Roman Lebedev's avatar
      [ConstantRange] Add `ushl_sat()`/`sshl_sat()` methods. · e0ea842b
      Roman Lebedev authored
      Summary:
      To be used in `ConstantRange::shlWithNoOverflow()`,
      may in future be useful for when saturating shift/mul ops are added.
      
      Unlike `ConstantRange::shl()`, these are precise.
      
      Reviewers: nikic, spatel, reames
      
      Reviewed By: nikic
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D69960
      e0ea842b
    • Yonghong Song's avatar
      [BPF] turn on -mattr=+alu32 for cpu version v3 and later · 6b8baf30
      Yonghong Song authored
      -mattr=+alu32 has shown good performance vs. without this attribute.
      Based on discussion at
        https://lore.kernel.org/bpf/1ec37838-966f-ec0b-5223-ca9b6eb0860d@fb.com/T/#t
      cpu version v3 should support -mattr=+alu32.
      This patch enabled alu32 if cpu version is v3, either specified by user
      or probed by the llvm.
      
      Differential Revision: https://reviews.llvm.org/D69957
      6b8baf30
    • Jason Molenda's avatar
      Reordering KextImageInfo::LoadImageUsingMemoryModule · 6602e1fb
      Jason Molenda authored
      so we only call ModulesDidLoad at the end of the method
      after the new module has been added to the target and
      the sections have all been adjusted to their actual
      load addresses.  Solves a problem where an operating
      system plugin in the kernel could be loaded multiple
      times; the first before the binary had even been
      added to the target.
      
      <rdar://problem/50523558>
      6602e1fb
    • Nemanja Ivanovic's avatar
      [PowerPC][Altivec] Fix offsets for vec_xl and vec_xst · e0407f54
      Nemanja Ivanovic authored
      As we currently have it implemented in altivec.h, the offsets for these two
      intrinsics are element offsets. The documentation in the ABI (as well as the
      implementation in both XL and GCC) states that these should be byte offsets.
      
      Differential revision: https://reviews.llvm.org/D63636
      e0407f54
    • Nemanja Ivanovic's avatar
      [PowerPC][Altivec] Emit correct builtin for single precision vec_all_ne · 070e4027
      Nemanja Ivanovic authored
      We currently emit a double precision comparison instruction for this, whereas we
      need to emit the single precision version.
      
      Differential revision: https://reviews.llvm.org/D64024
      070e4027
    • Nemanja Ivanovic's avatar
      [PowerPC] Option for enabling absolute jumptables with command line · 9af28400
      Nemanja Ivanovic authored
      This option allows the user to specify the use of absolute jumptables instead
      of relative which is the default on most PPC subtargets.
      
      Patch by Kamauu Bridgeman
      
      Differential revision: https://reviews.llvm.org/D69108
      9af28400
    • Artem Belevich's avatar
    • Artem Dergachev's avatar
      [analyzer] Add test cases for the unsupported C++ constructor modeling. · 5e0fb648
      Artem Dergachev authored
      Namely, for the following items:
      - Handle constructors within new[];
      - Handle constructors for default arguments.
      
      Update the open projects page with a link to the newly added tests
      and more hints for potential contributors.
      
      Patch by Daniel Krupp!
      
      Differential Revision: https://reviews.llvm.org/D69308
      5e0fb648
    • Artem Dergachev's avatar
      [analyzer] PR41729: CStringChecker: Improve strlcat and strlcpy modeling. · acac5404
      Artem Dergachev authored
      - Fix false positive reports of strlcat.
      - The return value of strlcat and strlcpy is now correctly calculated.
      - The resulting string length of strlcat and strlcpy is now correctly
        calculated.
      
      Patch by Daniel Krupp!
      
      Differential Revision: https://reviews.llvm.org/D66049
      acac5404
    • Shu-Chun Weng's avatar
      [llvm/test] Update test comments · 79367983
      Shu-Chun Weng authored
      79367983
    • Fangrui Song's avatar
      ddff808e
    • Craig Topper's avatar
      [InstCombine] Don't transform bitcasts between x86_mmx and v1i64 into insertelement/extractelement · 6749dc34
      Craig Topper authored
      x86_mmx is conceptually a vector already. Don't introduce an extra conversion between it and scalar i64.
      
      I'm using VectorType::isValidElementType which checks for floating point, integer, and pointers to hopefully make this more readable than just blacklisting x86_mmx.
      
      Differential Revision: https://reviews.llvm.org/D69964
      6749dc34
    • Sanjay Patel's avatar
      2f32da3d
    • Fred Riss's avatar
      Modernize TestWeakSymbols Makefile · cbdd92be
      Fred Riss authored
      cbdd92be
    • Reid Kleckner's avatar
      [SEH] Defer checking filter expression types until instantiaton · 7177ce97
      Reid Kleckner authored
      While here, wordsmith the error a bit. Now clang says:
        error: filter expression has non-integral type 'Foo'
      
      Fixes PR43779
      
      Reviewers: amccarth
      
      Differential Revision: https://reviews.llvm.org/D69969
      7177ce97
    • Sterling Augustine's avatar
      Correctly update isSignalFrame when unwinding the stack via dwarf. · d3c74431
      Sterling Augustine authored
      A "signal frame" is a function or block of code where execution arrives via a signal or interrupt, rather than via a normal call instruction. In fact, a particular instruction is interrupted by the signal and needs to be restarted. Therefore, when the signal handler is complete, execution needs to return to the interrupted instruction, rather than the instruction immediately following the call instruction, as in a normal call.
      
      Stack unwinders need to know this to correctly unwind signal frames. Dwarf handily provides an "S" in the CIE augmentation string to describe this case, and the libunwind API provides various functions to for unwinders to determine it,.
      
      The llvm libunwind implementation correctly sets it's internal variable "isSignalFrame" when initializing an unwind context. However, upon stepping up the stack, the current implementation correctly reads the augmentation string and sets it in the CIE info (which it then discards), ...
      d3c74431
    • LLVM GN Syncbot's avatar
      gn build: Merge 25ee8613 · b4237db2
      LLVM GN Syncbot authored
      b4237db2
    • Daniel Sanders's avatar
      [debugify] Move the Debugify pass from tools/opt to lib/Transform/Utils · 25ee8613
      Daniel Sanders authored
      Summary:
      I need to make use of this pass from a driver program that isn't opt.
      Therefore this patch moves this pass into the LLVM library so that it is
      available for use elsewhere.
      
      There was one function I kept in tools/opt which is exportDebugifyStats()
      this is because it's serializing the statistics into a human readable
      format and this seemed more in keeping with opt than a library function
      
      Reviewers: vsk, aprantl
      
      Subscribers: mgorny, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D69926
      25ee8613
    • Jan Korous's avatar
      [compiler-rt] Fix tests after 03b84e4f · bdeb2724
      Jan Korous authored
      Fallout from:
      [clang] Report sanitizer blacklist as a dependency in cc1
      
      Default blacklists are now passed via -fsanitize-system-blacklist from driver to cc1.
      bdeb2724
    • Jim Ingham's avatar
      BreakpointDummyOptionGroup was using g_breakpoint_modify_options rather than... · f1539b9d
      Jim Ingham authored
      BreakpointDummyOptionGroup was using g_breakpoint_modify_options rather than g_breakpoint_dummy_options
      causing the -D option for breakpoint set command to be incorrectly parsed.
      
      Patch by Martin Svensson.
      
      Differential Revision: https://reviews.llvm.org/D69425
      f1539b9d
    • Jan Korous's avatar
      [clang] Report sanitizer blacklist as a dependency in cc1 · 03b84e4f
      Jan Korous authored
      Previously these were reported from the driver which blocked clang-scan-deps from getting the full set of dependencies from cc1 commands.
      
      Also the default sanitizer blacklist that is added in driver was never reported as a dependency. I introduced -fsanitize-system-blacklist cc1 option to keep track of which blacklists were user-specified and which were added by driver and clang -MD now also reports system blacklists as dependencies.
      
      Differential Revision: https://reviews.llvm.org/D69290
      03b84e4f
    • Galina Kistanova's avatar
      Revert "[MachineVerifier] Improve verification of live-in lists. · ad3c9d46
      Galina Kistanova authored
      This reverts commit b7b170c9 to give the author more time to address failing tests on the expensive checks buildbots.
      ad3c9d46
    • Reid Kleckner's avatar
      [codeview] Reference types in type parent scopes · d91ed80e
      Reid Kleckner authored
      Without this change, when a nested tag type of any kind (enum, class,
      struct, union) is used as a variable type, it is emitted without
      emitting the parent type. In CodeView, parent types point to their inner
      types, and inner types do not point back to their parents. We already
      walk over all of the parent scopes to build the fully qualified name.
      This change simply requests their type indices as we go along to enusre
      they are all emitted.
      
      Fixes PR43905
      
      Reviewers: akhuang, amccarth
      
      Differential Revision: https://reviews.llvm.org/D69924
      d91ed80e
    • Dávid Bolvanský's avatar
      [Diagnostics] Teach -Wnull-dereference about address_space attribute · 01b10bc7
      Dávid Bolvanský authored
      Summary:
      Clang should not warn for:
      
      > test.c:2:12: warning: indirection of non-volatile null pointer will be deleted,
      >       not trap [-Wnull-dereference]
      >     return *(int __attribute__((address_space(256))) *) 0;
      >            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Solves PR42292.
      
      Reviewers: aaron.ballman, rsmith
      
      Reviewed By: aaron.ballman
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D69664
      01b10bc7
    • Vedant Kumar's avatar
    • Jonas Devlieghere's avatar
      [lldb] Improve assert in GDBRemoteCommunicationReplayServer · c62a9f18
      Jonas Devlieghere authored
      While investigating an issue where a different packet was sent during
      replay I noticed how annoying it is that the existing assert doesn't
      specify what packet is actually different. It's printed to the log, but
      enabling logging has the potential to change LLDB's behavior. The same
      is true when debugging LLDB while it's replaying the reproducer.
      
      I replaced the assert with a printf of the unexpected packet followed by
      a fatal_error wrapped in ifndef NDEBUG. The behavior is the same as the
      previous assert, just with more/better context.
      c62a9f18
    • Craig Topper's avatar
      [InstCombine] Add test cases to show bad canonicalization of bitcasts between... · 96119586
      Craig Topper authored
      [InstCombine] Add test cases to show bad canonicalization of bitcasts between x86_mmx and <1 x i64>.
      
      As the test cases show, we end up with an insert/extract and a
      bitcast to/from i64. x86_mmx is for some purposes conceptually a
      vector. We shouldn't be adding scalar conversions around it.
      
      Since _m64 is defined as <1 x i64> and intrinsics use x86_mmx
      as their input/output these extra scalar operations prevent
      the X86 backend from generating good code especially on 32-bit
      targets where i64 gets split.
      96119586