1. Jun 18, 2019
    • Haojian Wu's avatar
      [clangd] Detect C++ language based on well-known file path in vscode extension · 40fdd7a6
      Haojian Wu authored
      Summary:
      Matching the "C++" pattern on the first line of the file doesn't cover
      all cases, MSVC C++ headers doesn't have such pattern. This patch
      introduce a new heuristic to detect language based on the file path.
      
      MSVC C++ standard headers are in the directory like
      "c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\include"
      
      Reviewers: sammccall
      
      Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D63483
      
      llvm-svn: 363662
      40fdd7a6
    • Valery Pykhtin's avatar
      7e854e1c
    • Graham Hunter's avatar
      [SVE][IR] Scalable Vector IR Type with pr42210 fix · 43854e3c
      Graham Hunter authored
      Recommit of D32530 with a few small changes:
        - Stopped recursively walking through aggregates in
          the verifier, so that we don't impose too much
          overhead on large modules under LTO (see PR42210).
        - Changed tests to match; the errors are slightly
          different since they only report the array or
          struct that actually contains a scalable vector,
          rather than all aggregates which contain one in
          a nested member.
        - Corrected an older comment
      
      Reviewers: thakis, rengolin, sdesmalen
      
      Reviewed By: sdesmalen
      
      Differential Revision: https://reviews.llvm.org/D63321
      
      llvm-svn: 363658
      43854e3c
    • Simon Pilgrim's avatar
      [X86] Regenerate promote.ll. NFC. · 6658bfb1
      Simon Pilgrim authored
      llvm-svn: 363657
      6658bfb1
    • Diogo N. Sampaio's avatar
      [NFC] Improve triple match of scripts that update tests · 0265716b
      Diogo N. Sampaio authored
      Summary:
      The prior behavior of the triple matcher would stop
      in the first matched triple. It was not possible to
      create specific matches for sub-sets of a triple
      (e.g aarch64-apple-darwin would never be used after
      aarch64 was matched).
      
      This patch:
      1) Allows that specialized triples take priority,
      considering that the string lenght of the triple
      indentifies how specialized a triple is. If two
      triples of same lenght match, the one matched first
      prevails, preserving the old behavior.
      
      2) Remove 20 duplicated triples of arm, thumb,
      aarch64 options with same arguments, matching
      the common prefix (aarch64, arm, thumb) of them.
      
      3) Creates three new function matching regexes and
      five triple options for arm64-apple-ios,
      (arm|thumb)-apple-ios and thumb(v5)?-macho
      
      Reviewers: lebedev.ri, RKSimon, MaskRay, gbedwell
      
      Reviewed By: MaskRay
      
      Subscribers: javed.absar, kristof.beyls, llvm-commits, carwil
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D63145
      
      llvm-svn: 363656
      0265716b
    • Simon Pilgrim's avatar
      [X86] Replace any_extend* vector extensions with zero_extend* equivalents · 7dd529e5
      Simon Pilgrim authored
      First step toward addressing the vector-reduce-mul-widen.ll regression in D63281 - we should replace ANY_EXTEND/ANY_EXTEND_VECTOR_INREG in X86ISelDAGToDAG to avoid having to add duplicate patterns when treating any extensions as legal.
      
      In future patches this will also allow us to keep any extension nodes around a lot longer in the DAG, which should mean that we can keep better track of undef elements that otherwise become zeros that we think we have to keep......
      
      Differential Revision: https://reviews.llvm.org/D63326
      
      llvm-svn: 363655
      7dd529e5
    • Jeremy Morse's avatar
      [DebugInfo][Docs] Document that prologue/epilogue variable location changes are ignored · a1a4f5f1
      Jeremy Morse authored
      This patch documents that LLVM does not describe all changes in variable
      locations during the prologue and the epilogue. The debugger doesn't /
      shouldn't step through that portion of the function anyway, and describing
      every location through such stages would bloat location lists.
      
      Perform some minor cleanup at the same time,
       * Fix an enumerated list
       * Document that dbg.declare intrinsics have their variable location recorded
         in a MachineFunction table, not with DBG_VALUE meta-insts
       * Adds frame-indexes to the list of things that can be operands to
         DBG_VALUEs.
      
      Differential Revision: https://reviews.llvm.org/D63083
      
      llvm-svn: 363654
      a1a4f5f1
    • Pavel Labath's avatar
      Fix windows build for r363357 · afb17dae
      Pavel Labath authored
      MSVC has trouble referencing the protected Compare class from from the
      friend Entry operator<. Just delete that operator, as it's used only
      once.
      
      llvm-svn: 363653
      afb17dae
    • Yevgeny Rouban's avatar
      [SimplifyCFG] NFC, prof branch_weighs handling is simplified · 69daf4a7
      Yevgeny Rouban authored
      Using the new SwitchInstProfUpdateWrapper this patch
      simplifies 3 places of prof branch_weights handling.
      
      Differential Revision: https://reviews.llvm.org/D62123
      
      llvm-svn: 363652
      69daf4a7
    • Mikael Holmen's avatar
      Fix compiler warning by removing unused variable · 5136ea49
      Mikael Holmen authored
      llvm-svn: 363651
      5136ea49
    • Fangrui Song's avatar
      [llvm-objdump] Tidy up AMDGCNPrettyPrinter · 291e11ea
      Fangrui Song authored
      llvm-svn: 363650
      291e11ea
    • Fangrui Song's avatar
      Revert D60974 "[clang-ifs] Clang Interface Stubs, first version." · 2d94dd81
      Fangrui Song authored
      This reverts commit rC363626.
      
      clangIndex depends on clangFrontend. r363626 adds a dependency from
      clangFrontend to clangIndex, which creates a circular dependency.
      
      This is disallowed by -DBUILD_SHARED_LIBS=on builds:
      
          CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle):
            "clangFrontend" of type SHARED_LIBRARY
              depends on "clangIndex" (weak)
            "clangIndex" of type SHARED_LIBRARY
              depends on "clangFrontend" (weak)
          At least one of these targets is not a STATIC_LIBRARY.  Cyclic dependencies are allowed only among static libraries.
      
      Note, the dependency on clangIndex cannot be removed because
      libclangFrontend.so is linked with -Wl,-z,defs: a shared object must
      have its full direct dependencies specified on the linker command line.
      
      In -DBUILD_SHARED_LIBS=off builds, this appears to work when linking
      `bin/clang-9`. However, it can cause trouble to downstream clang library
      users. The llvm build system links libraries this way:
      
          clang main_program_object_file ... lib/libclangIndex.a ...  lib/libclangFrontend.a -o exe
      
      libclangIndex.a etc are not wrapped in --start-group.
      
      If the downstream application depends on libclangFrontend.a but not any
      other clang libraries that depend on libclangIndex.a, this can cause undefined
      reference errors when the linker is ld.bfd or gold.
      
      The proper fix is to not include clangIndex files in clangFrontend.
      
      llvm-svn: 363649
      2d94dd81
    • Puyan Lotfi's avatar
      [NFC] Undoing r363646 to fix bots. · 4d367824
      Puyan Lotfi authored
      -DBUILD_SHARED_LIBS=ON is still having problem caused by layering issues with
      D60974. Locally there weren't problems building with shared libs on or off but
      the bots appear to be acting up.
      
      llvm-svn: 363648
      4d367824
    • Craig Topper's avatar
      [X86] Add i128 ctpop and i32/i64/i128 optsize test cases to popcnt.ll · 02a445c2
      Craig Topper authored
      Test cases for PR41151 and D59909.
      
      llvm-svn: 363647
      02a445c2
    • Puyan Lotfi's avatar
      e86b89ba
    • Craig Topper's avatar
      [X86] Move code that shrinks immediates for ((x << C1) op C2) into a helper function. NFCI · f4284f8a
      Craig Topper authored
      Preliminary step for D59909
      
      llvm-svn: 363645
      f4284f8a
    • Craig Topper's avatar
      [X86] Remove MOVDI2SSrm/MOV64toSDrm/MOVSS2DImr/MOVSDto64mr CodeGenOnly instructions. · 58742771
      Craig Topper authored
      The isel patterns for these use a bitcast and load/store, but
      DAG combine should have canonicalized those away.
      
      For the purposes of the memory folding table these opcodes can be
      replaced by the MOVSSrm_alt/MOVSDrm_alt and MOVSSmr/MOVSDmr opcodes.
      
      llvm-svn: 363644
      58742771
    • Craig Topper's avatar
      [X86] Introduce new MOVSSrm/MOVSDrm opcodes that use VR128 register class. · 8582ecd8
      Craig Topper authored
      Rename the old versions that use FR32/FR64 to MOVSSrm_alt/MOVSDrm_alt.
      
      Use the new versions in patterns that previously used a COPY_TO_REGCLASS
      to VR128. These patterns expect the upper bits to be zero. The
      current set up appears to work, but I'm not sure we should be
      enforcing upper bits being zero through a COPY_TO_REGCLASS.
      
      I wanted to flip the arrangement and use a COPY_TO_REGCLASS to
      FR32/FR64 for the patterns that need an f32/f64 result, but that
      complicated fastisel and globalisel.
      
      I've been doing some experiments with reducing some isel patterns
      and ended up in a situation where I had a
      (SUBREG_TO_REG (COPY_TO_RECLASS (VMOVSSrm), VR128)) and our
      post-isel peephole was unable to avoid using an instruction for
      the SUBREG_TO_REG due to the COPY_TO_REGCLASS. Having a VR128
      instruction removes the COPY_TO_REGCLASS that was breaking this.
      
      llvm-svn: 363643
      8582ecd8
    • Tom Stellard's avatar
      GlobalISel: Remove redundant pass initialization · 1f7f6466
      Tom Stellard authored
      Summary:
      All the GlobalISel passes are initialized when the target calls
      initializeGlobalISel(), so we don't need to call the initializers
      from the pass constructors.
      
      Reviewers: qcolombet, t.p.northover, paquette, dsanders, aemerson, aditya_nandakumar
      
      Reviewed By: aemerson
      
      Subscribers: rovka, kristof.beyls, hiraditya, volkan, Petar.Avramovic, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D63235
      
      llvm-svn: 363642
      1f7f6466
    • Dan Liew's avatar
      Disable recently added Darwin symbolization tests for iOS. · 9216358c
      Dan Liew authored
      These tests won't necessarily work because the reported modules paths
      from the device don't match what's on the host and so offline
      symbolization fails.
      
      llvm-svn: 363641
      9216358c
    • Dan Liew's avatar
      [NFC] Split `Darwin/asan-symbolize-partial-report-with-module-map.cc`. · 745632c6
      Dan Liew authored
      Split `Darwin/asan-symbolize-partial-report-with-module-map.cc` into two
      separate test cases due to them testing slightly different things.
      
      llvm-svn: 363640
      745632c6
    • Dan Liew's avatar
      [asan_symbolize] Teach `asan_symbolize.py` to symbolicate partially symbolicated ASan reports. · 3c9f66dc
      Dan Liew authored
      Summary:
      The use case here is to be able symbolicate ASan reports that might be
      partially symbolicated, in particular where the function name is known but no source
      location is available. This can be caused by missing debug info. Previously we
      would only try to symbolicate completely unsymbolicated reports.
      
      The code currently contains an unfortunate quirk to handle a darwin
      specific bug (rdar://problem/49784442) in the way partially symbolicated
      reports are emitted when the source location is missing.
      
      rdar://problem/49476995
      
      Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka
      
      Subscribers: aprantl, #sanitizers, llvm-commits
      
      Tags: #llvm, #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D60533
      
      llvm-svn: 363639
      3c9f66dc
    • Alex Brachet's avatar
      [llvm-strip] Error when using stdin twice · 77477009
      Alex Brachet authored
      Summary: Implements bug [[ https://bugs.llvm.org/show_bug.cgi?id=42204 | 42204 ]]. llvm-strip now warns when the same input file is used more than once, and errors when stdin is used more than once.
      
      Reviewers: jhenderson, rupprecht, espindola, alexshap
      
      Reviewed By: jhenderson, rupprecht
      
      Subscribers: emaste, arichardson, jakehehrlich, MaskRay, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D63122
      
      llvm-svn: 363638
      77477009
    • Matt Arsenault's avatar
      GlobalISel: Use the original flags when lowering fneg to fsub · 5a321b89
      Matt Arsenault authored
      This was ignoring the flag on fneg, and using the source instruction's
      flags. Also fixes tests missing from r358702.
      
      Note the expansion itself isn't correct without nnan, but that should
      be fixed separately.
      
      llvm-svn: 363637
      5a321b89
    • Peter Collingbourne's avatar
      hwasan: Use bits [3..11) of the ring buffer entry address as the base stack tag. · d57f7cc1
      Peter Collingbourne authored
      This saves roughly 32 bytes of instructions per function with stack objects
      and causes us to preserve enough information that we can recover the original
      tags of all stack variables.
      
      Now that stack tags are deterministic, we no longer need to pass
      -hwasan-generate-tags-with-calls during check-hwasan. This also means that
      the new stack tag generation mechanism is exercised by check-hwasan.
      
      Differential Revision: https://reviews.llvm.org/D63360
      
      llvm-svn: 363636
      d57f7cc1
    • Peter Collingbourne's avatar
      hwasan: Add a tag_offset DWARF attribute to instrumented stack variables. · fb9ce100
      Peter Collingbourne authored
      The goal is to improve hwasan's error reporting for stack use-after-return by
      recording enough information to allow the specific variable that was accessed
      to be identified based on the pointer's tag. Currently we record the PC and
      lower bits of SP for each stack frame we create (which will eventually be
      enough to derive the base tag used by the stack frame) but that's not enough
      to determine the specific tag for each variable, which is the stack frame's
      base tag XOR a value (the "tag offset") that is unique for each variable in
      a function.
      
      In IR, the tag offset is most naturally represented as part of a location
      expression on the llvm.dbg.declare instruction. However, the presence of the
      tag offset in the variable's actual location expression is likely to confuse
      debuggers which won't know about tag offsets, and moreover the tag offset
      is not required for a debugger to determine the location of the variable on
      the stack, so at the DWARF level it is represented as an attribute so that
      it will be ignored by debuggers that don't know about it.
      
      Differential Revision: https://reviews.llvm.org/D63119
      
      llvm-svn: 363635
      fb9ce100
    • Peter Collingbourne's avatar
      gn build: Merge r363626. · c3b6d777
      Peter Collingbourne authored
      llvm-svn: 363634
      c3b6d777
    • Dan Liew's avatar
      [CMake] Fix the value of `config.target_cflags` for non-macOS Apple platforms. Attempt #2. · 964909e4
      Dan Liew authored
      Summary:
      The main problem here is that `-*-version_min=` was not being passed to
      the compiler when building test cases. This can cause problems when
      testing on devices running older OSs because Clang would previously
      assume the minimum deployment target is the the latest OS in the SDK
      which could be much newer than what the device is running.
      
      Previously the generated value looked like this:
      
      `-arch arm64 -isysroot
      <path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk`
      
      With this change it now looks like:
      
      `-arch arm64 -stdlib=libc++ -miphoneos-version-min=8.0 -isysroot
      <path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk`
      
      This mirrors the setting of `config.target_cflags` on macOS.
      
      This change is made for ASan, LibFuzzer, TSan, and UBSan.
      
      To implement this a new `get_test_cflags_for_apple_platform()` function
      has been added that when given an Apple platform name and architecture
      returns a string containing the C compiler flags to use when building
      tests. This also calls a new helper function `is_valid_apple_platform()`
      that validates Apple platform names.
      
      This is the second attempt at landing the patch. The first attempt (r359305)
      had to be reverted (r359327) due to a buildbot failure. The problem was
      that calling `get_test_cflags_for_apple_platform()` can trigger a CMake
      error if the provided architecture is not supported by the current
      CMake configuration. Previously, this could be triggered by passing
      `-DCOMPILER_RT_ENABLE_IOS=OFF` to CMake. The root cause is that we were
      generating test configurations for a list of architectures without
      checking if the relevant Sanitizer actually supported that architecture.
      We now intersect the list of architectures for an Apple platform
      with `<SANITIZER>_SUPPORTED_ARCH` (where `<SANITIZER>` is a Sanitizer
      name) to iterate through the correct list of architectures.
      
      rdar://problem/50124489
      
      Reviewers: kubamracek, yln, vsk, juliehockett, phosek
      
      Subscribers: mgorny, javed.absar, kristof.beyls, #sanitizers, llvm-commits
      
      Tags: #llvm, #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D61242
      
      llvm-svn: 363633
      964909e4
    • Amara Emerson's avatar
      [GlobalISel][Localizer] Rewrite localizer to run in 2 phases, inter & intra block. · 14688224
      Amara Emerson authored
      Inter-block localization is the same as what currently happens, except now it
      only runs on the entry block because that's where the problematic constants with
      long live ranges come from.
      
      The second phase is a new intra-block localization phase which attempts to
      re-sink the already localized instructions further right before one of the
      multiple uses.
      
      One additional change is to also localize G_GLOBAL_VALUE as they're constants
      too. However, on some targets like arm64 it takes multiple instructions to
      materialize the value, so some additional heuristics with a TTI hook have been
      introduced attempt to prevent code size regressions when localizing these.
      
      Overall, these changes improve CTMark code size on arm64 by 1.2%.
      
      Full code size results:
      
      Program                                         baseline       new       diff
      ------------------------------------------------------------------------------
       test-suite...-typeset/consumer-typeset.test    1249984      1217216     -2.6%
       test-suite...:: CTMark/ClamAV/clamscan.test    1264928      1232152     -2.6%
       test-suite :: CTMark/SPASS/SPASS.test          1394092      1361316     -2.4%
       test-suite...Mark/mafft/pairlocalalign.test    731320       714928      -2.2%
       test-suite :: CTMark/lencod/lencod.test        1340592      1324200     -1.2%
       test-suite :: CTMark/kimwitu++/kc.test         3853512      3820420     -0.9%
       test-suite :: CTMark/Bullet/bullet.test        3406036      3389652     -0.5%
       test-suite...ark/tramp3d-v4/tramp3d-v4.test    8017000      8016992     -0.0%
       test-suite...TMark/7zip/7zip-benchmark.test    2856588      2856588      0.0%
       test-suite...:: CTMark/sqlite3/sqlite3.test    765704       765704       0.0%
       Geomean difference                                                      -1.2%
      
      Differential Revision: https://reviews.llvm.org/D63303
      
      llvm-svn: 363632
      14688224
    • Michael Berg's avatar
      Propagate fmf in IRTranslate for fneg · f9bff2a5
      Michael Berg authored
      Summary: This case is related to D63405 in that we need to be propagating FMF on negates.
      
      Reviewers: volkan, spatel, arsenm
      
      Reviewed By: arsenm
      
      Subscribers: wdng, javed.absar
      
      Differential Revision: https://reviews.llvm.org/D63458
      
      llvm-svn: 363631
      f9bff2a5
    • Craig Topper's avatar
      Use VR128X instead of FR32X/FR64X for the register class in VMOVSSZmrk/VMOVSDZmrk. · 971ad74b
      Craig Topper authored
      Removes COPY_TO_REGCLASS from some patterns.
      
      llvm-svn: 363630
      971ad74b
    • Craig Topper's avatar
      [X86] Make an assert in LowerSCALAR_TO_VECTOR stricter to make it clear what... · 0e183008
      Craig Topper authored
      [X86] Make an assert in LowerSCALAR_TO_VECTOR stricter to make it clear what types are allowed here. NFC
      
      Make it clear that only integer type with i32 or smaller elements shoudl get to this part of the code.
      
      llvm-svn: 363629
      0e183008
    • Francis Visoiu Mistrih's avatar
      [Remarks][Driver] Use the specified format in the remarks file extension · 36a7a982
      Francis Visoiu Mistrih authored
      By default, use `.opt.yaml`, but when a format is specified with
      `-fsave-optimization-record=<format>`, use `.opt.<format>`.
      
      llvm-svn: 363627
      36a7a982
    • Puyan Lotfi's avatar
      [clang-ifs] Clang Interface Stubs, first version. · 8df7f1a2
      Puyan Lotfi authored
      Clang interface stubs (previously referred to as clang-ifsos) is a new frontend
      action in clang that allows the generation of stub files that contain mangled
      name info that can be used to produce a stub library. These stub libraries can
      be useful for breaking up build dependencies and controlling access to a
      library's internal symbols. Generation of these stubs can be invoked by:
      
      clang -fvisibility=<visibility> -emit-interface-stubs \
                                      -interface-stub-version=<interface format>
      
      Notice that -fvisibility (along with use of visibility attributes) can be used
      to control what symbols get generated. Currently the interface format is
      experimental but there are a wide range of possibilities here.
      
      Differential Revision: https://reviews.llvm.org/D60974
      
      llvm-svn: 363626
      8df7f1a2
    • Stanislav Mekhanoshin's avatar
      [AMDGPU] Use custom inserter for gfx10 VOP2b · 12195610
      Stanislav Mekhanoshin authored
      This is part of the approved D63204 pending parent revision.
      This small change is in fact a part of the VOP2b legalization which
      does not technically belong to wave32 support, so extracted
      separately.
      
      llvm-svn: 363625
      12195610
    • Mitch Phillips's avatar
      [GWP-ASan] Disable GWP-ASan on Android for now. · 8fbb88fb
      Mitch Phillips authored
      Summary:
      Temporarily disable GWP-ASan for android until the bugs at:
      http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/builds/87
      ... can be fixed. See comments for the full bug trace.
      
      Reviewers: eugenis
      
      Reviewed By: eugenis
      
      Subscribers: srhines, kubamracek, mgorny, cryptoad, jfb, #sanitizers, llvm-commits
      
      Tags: #sanitizers, #llvm
      
      Differential Revision: https://reviews.llvm.org/D63460
      
      llvm-svn: 363624
      8fbb88fb
    • Stanislav Mekhanoshin's avatar
      [AMDGPU] gfx1010 subvector test. NFC. · ca42687d
      Stanislav Mekhanoshin authored
      llvm-svn: 363623
      ca42687d
    • Richard Smith's avatar
      Fix crash when checking a dependently-typed reference that is · 94bc88eb
      Richard Smith authored
      initialized from a non-value-dependent initializer.
      
      llvm-svn: 363622
      94bc88eb
    • Volkan Keles's avatar
      [test][AArch64] Relax the check line for G_BRJT in legalizer-info-validation.mir · 689509ed
      Volkan Keles authored
      Replace the specific number with a pattern to relax the test.
      
      llvm-svn: 363621
      689509ed
    • Richard Smith's avatar
      Rewrite ConstStructBuilder with a mechanism that can cope with splitting and updating constants. · 5745febe
      Richard Smith authored
      Summary:
      This adds a ConstantBuilder class that deals with incrementally building
      an aggregate constant, including support for overwriting
      previously-emitted parts of the aggregate with new values.
      
      This fixes a bunch of cases where we used to be unable to reduce a
      DesignatedInitUpdateExpr down to an IR constant, and also lays some
      groundwork for emission of class constants with [[no_unique_address]]
      members.
      
      Reviewers: rjmccall
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D63371
      
      llvm-svn: 363620
      5745febe