1. Jun 19, 2017
    • Nirav Dave's avatar
      Allow truncated and extend memory operations in Store Merge. NFCI. · 8dcd008d
      Nirav Dave authored
      As all store merges checks are based on the memory operation
      performed, allow use of truncated stores and extended loads as valid
      input candidates for merging.
      
      Relanding after fixing selection between truncated and normal store.
      
      llvm-svn: 305701
      8dcd008d
    • Andrew Ng's avatar
      [LLD][LinkerScript] Add support for segment NONE. · 6e9f98c1
      Andrew Ng authored
      This patch adds support for segment NONE in linker scripts which enables the
      specification that a section should not be assigned to any segment.
      
      Note that GNU ld does not disallow the definition of a segment named NONE, which
      if defined, effectively overrides the behaviour described above. This feature
      has been copied.
      
      Differential Revision: https://reviews.llvm.org/D34203
      
      llvm-svn: 305700
      6e9f98c1
    • Anna Thomas's avatar
      [JumpThreading][LVI] Invalidate LVI information after blocks are merged · 7949f452
      Anna Thomas authored
      Summary:
      After a single predecessor is merged into a basic block, we need to invalidate
      the LVI information for the new merged block, when LVI is not provably true for
      all of instructions in the new block.
      The test cases added show the correct LVI information using the LVI printer
      pass.
      
      Reviewers: reames, dberlin, davide, sanjoy
      
      Reviewed by: dberlin, davide
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D34108
      
      llvm-svn: 305699
      7949f452
    • Xin Tong's avatar
      [TRE] Improve code motion in TRE, use AA to tell whether a load can be moved... · b412831d
      Xin Tong authored
      [TRE] Improve code motion in TRE, use AA to tell whether a load can be moved before a call that writes to memory.
      
      Summary: use AA to tell whether a load can be moved before a call that writes to memory.
      
      Reviewers: dberlin, davide, sanjoy, hfinkel
      
      Reviewed By: hfinkel
      
      Subscribers: hfinkel, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D34115
      
      llvm-svn: 305698
      b412831d
    • Nirav Dave's avatar
      Add test for store merge with noimplicitfloat · 4e363e36
      Nirav Dave authored
      llvm-svn: 305697
      4e363e36
    • Francois Ferrand's avatar
      clang-format: Fix C99 designated initializers corner cases · 5f07f443
      Francois Ferrand authored
      Summary:
      This fixes the missing space before the designated initializer when `Cpp11BracedListStyle=false` :
      
        const struct A a = { .a = 1, .b = 2 };
                            ^
      
      Also, wrapping between opening brace and designated array initializers used to have an excessive penalty (like breaking between an expression and the subscript operator), leading to unexpected wrapping:
      
        const struct Aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa =
            {[1] = aaaaaaaaaaaaaaaaaaaaaaaaaaa,
             [2] = bbbbbbbbbbbbbbbbbbbbbbbbbbb};
      
      instead of:
      
        const struct Aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa = {
            [1] = aaaaaaaaaaaaaaaaaaaaaaaaaaa,
            [2] = bbbbbbbbbbbbbbbbbbbbbbbbbbb};
      
      Finally, designated array initializers are not binpacked, just like designated member initializers.
      
      Reviewers: djasper
      
      Reviewed By: djasper
      
      Subscribers: cfe-commits, krasimir, klimek
      
      Differential Revision: https://reviews.llvm.org/D33491
      
      llvm-svn: 305696
      5f07f443
    • Francis Ricci's avatar
      Add lsan interceptors for libdispatch functions on darwin · 4f1e047a
      Francis Ricci authored
      Summary:
      This is required for standalone LSan to work with libdispatch worker threads,
      and is a slimmed down version of the functionality provided for ASan
      in asan_mac.cc.
      
      Reviewers: alekseyshl, kubamracek, glider, kcc
      
      Subscribers: mgorny, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D34247
      
      llvm-svn: 305695
      4f1e047a
    • Florian Hahn's avatar
      [AArch64] Fix order of checks in shouldScheduleAdjacent. · fd44ca6c
      Florian Hahn authored
      We need to check the opcode of FirstMI before accessing the operands. This
      caused a buildbot failure during bootstrapping on AArch64.
      
      llvm-svn: 305694
      fd44ca6c
    • Simon Pilgrim's avatar
      Use range for loops. NFCI. · 48bed539
      Simon Pilgrim authored
      llvm-svn: 305693
      48bed539
    • Tom Stellard's avatar
      AMDGPU/GlobalISel: Mark G_BITCAST s32 <--> <2 x s16> legal · ff63ee0d
      Tom Stellard authored
      Reviewers: arsenm
      
      Reviewed By: arsenm
      
      Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, igorb, dstuttard, tpr, t-tye, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D34129
      
      llvm-svn: 305692
      ff63ee0d
    • Igor Breger's avatar
      [GlobalISel][X86] Fold FI/G_GEP into LDR/STR instruction addressing mode. · bd2dedaa
      Igor Breger authored
      Summary: Implement some of the simplest addressing modes.It should help to test ABI.
      
      Reviewers: zvi, guyblank
      
      Reviewed By: guyblank
      
      Subscribers: rovka, llvm-commits, kristof.beyls
      
      Differential Revision: https://reviews.llvm.org/D33888
      
      llvm-svn: 305691
      bd2dedaa
    • Florian Hahn's avatar
      Recommit rL305677: [CodeGen] Add generic MacroFusion pass · 5f746c8e
      Florian Hahn authored
      Use llvm::make_unique to avoid ambiguity with MSVC.
      
      This patch adds a generic MacroFusion pass, that is used on X86 and
      AArch64, which both define target-specific shouldScheduleAdjacent
      functions. This generic pass should make it easier for other targets to
      implement macro fusion and I intend to add macro fusion for ARM shortly.
      
      Differential Revision: https://reviews.llvm.org/D34144
      
      llvm-svn: 305690
      5f746c8e
    • Pavel Labath's avatar
      Add pretty-printer for wait(2) statuses and modernize the code handling them · 3508fc8c
      Pavel Labath authored
      Summary:
      A number of places were trying to decode the result of wait(). Add a simple
      utility function that does that and a struct that encapsulates the
      decoded result. Then also provide a pretty-printer for that class.
      
      Reviewers: zturner, krytarowski, eugene
      
      Subscribers: lldb-commits, mgorny
      
      Differential Revision: https://reviews.llvm.org/D33998
      
      llvm-svn: 305689
      3508fc8c
    • Christof Douma's avatar
      Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc" · cc1c1128
      Christof Douma authored
      This reverts commit 305684.
      This patch breaks extra/tools/clang-tidy
      
      llvm-svn: 305688
      cc1c1128
    • Pavel Labath's avatar
      Tweak SysV_arm64 function entry unwind plan · 9376007a
      Pavel Labath authored
      Summary:
      The motivation for this is to make sure the first row of the plan
      compares equal to the first row of a generic debug_frame unwind plan.
      Right now, the code in FuncUnwinders::GetUnwindPlanAtNonCallSite
      considers them unequal because they specify the return address in a
      different way (SetReturnAddressRegister(LR) vs. an explicit PC=LR rule).
      This means that FuncUnwinders would always choose the debug_frame unwind
      plan, which is not correct, as that one is usually not correct at all
      locations.
      
      Right now this is basically a noop because we don't have parse any
      debug_frame plans, but it fixes some test failures when merging D33504
      in.
      
      I have to say I don't understand the full implications of the switch to
      SetReturnAddressRegister() way of doing things, but given that all of
      our other unwind plans (eh_frame, instruction profiling) do it this way,
      it sounds like the right thing to do.
      
      Reviewers: tberghammer, jasonmolenda, omjavaid
      
      Subscribers: aemerson, javed.absar, kristof.beyls, lldb-commits
      
      Differential Revision: https://reviews.llvm.org/D34199
      
      llvm-svn: 305687
      9376007a
    • Pavel Labath's avatar
      Delete ProcessLauncherPosix · 319b3839
      Pavel Labath authored
      Summary:
      ProcessLauncherPosix was using posix_spawn for launching the process,
      but this function is not available on all platforms we support, and even
      where it was avaialable, it did not support the full range of options we
      require for launching (most importantly, launching in stop-on-entry
      mode). For these reasons, the set of ifdefs around these functions has
      grown untractably large, and we were forced to implement our own
      launcher from more basic primitives anyway (ProcessLauncherPosixFork --
      used on Linux, Android, and NetBSD).
      
      Therefore, I remove this class, and move the relevant parts of the code
      to the darwin-specific Host.mm file. This is the platform that code was
      originally written for anyway, and it's the only platform where this
      implementation makes sense (e.g. the lack of the "thread-specific
      working directory" concept makes these functions racy on all other
      platforms). This allows us to remove a lot of ifdefs and simplify the
      code.
      
      Effectively, the only change this introduces is that FreeBSD will now
      use the fork-based launcher instead of posix_spawnp. That sholdn't be a
      problem as this approach works at least on one other BSD-based system
      already.
      
      Reviewers: krytarowski, emaste, jingham
      
      Subscribers: srhines, mgorny, lldb-commits
      
      Differential Revision: https://reviews.llvm.org/D34236
      
      llvm-svn: 305686
      319b3839
    • Alex Lorenz's avatar
      Move the test from r305678 to a separte file with 'REQUIRES: system-darwin' · 89cfff03
      Alex Lorenz authored
      Otherwise it will fail on non-macOS systems.
      
      llvm-svn: 305685
      89cfff03
    • Christof Douma's avatar
      [NFC] Refactor DiagnosticRenderer to use FullSourceLoc · f9d86db7
      Christof Douma authored
      Move the DiagnosticRenderer and its dependents to using FullSourceLocs
      instead of a SourceLocation and SourceManager pointer. The changeset is
      rather large but entirely mechanical.
      
      This is step one to allow DiagnosticRenderer to take either
      llvm::SMLocs or clang::SourceLocations.
      
      Patch by Sanne Wouda
      
      Review: https://reviews.llvm.org/D31709
      
      Change-Id: If351a112cdf6718e2d3ef6721b8da9c6376b32dd
      llvm-svn: 305684
      f9d86db7
    • Diana Picus's avatar
      [ARM] GlobalISel: Support G_ICMP for s8 and s16 · 78aaf7db
      Diana Picus authored
      Widen to s32 (like all other binary ops).
      
      llvm-svn: 305683
      78aaf7db
    • Sagar Thakur's avatar
      [scudo] Enabling MIPS support for Scudo · 6478d14a
      Sagar Thakur authored
      Adding MIPS 32-bit and 64-bit support for Scudo.
      
      Reviewed by cryptoad, sdardis.
      Differential: D31803
      
      llvm-svn: 305682
      6478d14a
    • Florian Hahn's avatar
      Revert r305677 [CodeGen] Add generic MacroFusion pass. · e16d3106
      Florian Hahn authored
      This causes Windows buildbot failures do an ambiguous call.
      
      llvm-svn: 305681
      e16d3106
    • Alex Lorenz's avatar
      Add missing OS check to r305678 · ae9afeb5
      Alex Lorenz authored
      That commit failed on non-macOS buildbots as I've forgotten to make sure that
      the system on which Clang is running on is actually macOS.
      
      llvm-svn: 305680
      ae9afeb5
    • James Henderson's avatar
      [ELF] Emit only one error if -z max-page-size without value · 38e67e82
      James Henderson authored
      In r305364, Rui changed the mechanism that parses -z option values slightly.
      This caused a bug, as demonstrated by this test, which now fails:
      
      ---
      # REQUIRES: x86
      # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
      # RUN: ld.lld %t.o -o %t -z max-page-size
      
      .global _start
      _start:
        nop
      ---
      
      Before, the link succeeded and set the max-page-size to the target default.
      
      After we get the following two error messages:
      "invalid max-page-size: "
      "max-page-size: value isn't a power of 2"
      
      The latter error is because an uninitialised variable ends up being passed back
      to getMaxPageSize).
      
      This change ensures we only get the first error.
      
      Reviewers: ruiu
      
      Differential Revision: https://reviews.llvm.org/D34234
      
      llvm-svn: 305679
      38e67e82
    • Alex Lorenz's avatar
      [driver][macOS] Pick the system version for the deployment target · dad1e1a3
      Alex Lorenz authored
      if the SDK is newer than the system
      
      This commit improves the driver by making sure that it picks the system version
      for the deployment target when the version of the macOS SDK is newer than the
      system version.
      
      rdar://29449467
      
      Differential Revision: https://reviews.llvm.org/D34175
      
      llvm-svn: 305678
      dad1e1a3
    • Florian Hahn's avatar
      [CodeGen] Add generic MacroFusion pass. · ee1b096f
      Florian Hahn authored
      Summary:
      This patch adds a generic MacroFusion pass, that is used on X86 and
      AArch64, which both define target-specific shouldScheduleAdjacent
      functions. This generic pass should make it easier for other targets to
      implement macro fusion and I intend to add macro fusion for ARM shortly.
      
      Reviewers: craig.topper, evandro, t.p.northover, atrick, MatzeB
      
      Reviewed By: MatzeB
      
      Subscribers: atrick, aemerson, mgorny, javed.absar, kristof.beyls, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D34144
      
      llvm-svn: 305677
      ee1b096f
    • Tobias Grosser's avatar
    • Michael Kruse's avatar
      [CodeGen] Emit aliasing metadata for new arrays. · 214deb79
      Michael Kruse authored
      Ensure that all array base pointers are assigned before generating
      aliasing metadata by allocating new arrays beforehand.
      
      Before this patch, getBasePtr() returned nullptr for new arrays because
      the arrays were created at a later point. Nullptr did not match to any
      array after the created array base pointers have been assigned and when
      the loads/stores are generated.
      
      llvm-svn: 305675
      214deb79
    • Michael Kruse's avatar
      [CodeGen] Deterministic aliasing metadata order. NFC. · 4aac459c
      Michael Kruse authored
      Replace DenseMap by a MapVector to enure that aliasing metadata is
      always emitted in the same order.
      
      llvm-svn: 305674
      4aac459c
    • Peter Smith's avatar
      [ELF] make default for get{ARM,AArch64}UndefinedRelativeWeakVA unreachable · 9873c4b5
      Peter Smith authored
          
      The get{ARM,AArch64}UndefinedRelativeWeakVA() functions should only be
      called for PC-relative relocations. Complete the supported pc-relative
      relocations in the switch statement and make the default case unreachable.
      
      The R_ARM_TARGET relocation can be evaluated as R_ARM_REL32 but it is only
      used in the context of exception tables, and is never output with respect
      to a weak reference so it does not appear in the switch statement.
          
      Differential Revision: https://reviews.llvm.org/D34138
      
      llvm-svn: 305673
      9873c4b5
    • Diana Picus's avatar
      [ARM] GlobalISel: Support G_ICMP for i32 and pointers · 621894ac
      Diana Picus authored
      Add support throughout the pipeline:
      - mark as legal for s32 and pointers
      - map to GPRs
      - lower to a sequence of instructions, which moves 0 or 1 into the
        result register based on the flags set by a CMPrr
      
      We have copied from FastISel a helper function which maps CmpInst
      predicates into ARMCC codes. Ideally, we should be able to move it
      somewhere that both FastISel and GlobalISel can use.
      
      llvm-svn: 305672
      621894ac
    • Guy Blank's avatar
      [X86] Simplify vector-shuffle-v48 test. NFC. · f4a09e55
      Guy Blank authored
      llvm-svn: 305670
      f4a09e55
    • Daniel Marjamaki's avatar
      [analyzer] Fix logical not for pointers with different bit width · 9c6e8489
      Daniel Marjamaki authored
      Differential Revision: https://reviews.llvm.org/D31029
      
      llvm-svn: 305669
      9c6e8489
    • Michael Park's avatar
      Add a missing SFINAE condition to the `variant`'s converting constructor. · 3f1e8938
      Michael Park authored
      Remarks: This function shall not participate in overload resolution unless
               `is_same_v<decay_t<T>, variant>` is false, unless `decay_t<T>` is
               neither a specialization of `in_place_type_t` nor a specialization of
               `in_place_index_t`, unless `is_constructible_v<Tj, T>` is true, and
               unless the expression `FUN(std::forward<T>(t))` (with `FUN` being the
               above-mentioned set of imaginary functions) is well formed.
      
      Depends on D34111.
      
      Reviewers: EricWF, K-ballo
      
      Reviewed By: EricWF
      
      Subscribers: fhahn
      
      Differential Revision: https://reviews.llvm.org/D34112
      
      llvm-svn: 305668
      3f1e8938
    • Daniel Jasper's avatar
      clang-format: Improve understanding of combined typedef+record declarations · f92659e4
      Daniel Jasper authored
      Fixes an issue where struct A { int X; }; would be broken onto multiple
      lines, but typedef struct A { int X; } A2; was collapsed onto a single
      line.
      
      Patch by Jacob Bandes-Storch. Thank you.
      
      llvm-svn: 305667
      f92659e4
    • Daniel Jasper's avatar
      clang-format: Handle "if constexpr". · 6a7d5a7a
      Daniel Jasper authored
      c++1z adds the following constructions to the language:
      
        if constexpr (cond)
          statement1;
        else if constexpr (cond)
          statement2;
        else if constexpr (cond)
          statement3;
        else
          statement4;
      
      A first version of this was proposed in reviews.llvm.org/D26953 by
      Francis Visoiu Mistrih, but never commited. This patch additionally
      fixes the behavior when allowing short if statements on a single line
      and was authored by Jacob Bandes-Storch. Thank you to both authors.
      
      llvm-svn: 305666
      6a7d5a7a
    • Daniel Jasper's avatar
      clang-format: Add capability to format the diff on save in vim. · 271dd060
      Daniel Jasper authored
      With this patch, one can configure a BufWrite hook that will make the
      clang-format integration compute a diff of the current buffer with the file
      that's on disk and format all changed lines. This should create a
      zero-overhead auto-format solution that doesn't require the file to
      already be clang-format clean to avoid spurious diffs.
      
      Review: https://reviews.llvm.org/D32429
      llvm-svn: 305665
      271dd060
    • Sylvestre Ledru's avatar
      Fix a -Wmisleading-indentation warning · f955efc0
      Sylvestre Ledru authored
      llvm-svn: 305664
      f955efc0
    • Max Kazantsev's avatar
      [SCEV] Teach SCEVExpander to expand BinPow · 35b2a18e
      Max Kazantsev authored
      Current implementation of SCEVExpander demonstrates a very naive behavior when
      it deals with power calculation. For example, a SCEV for x^8 looks like
      
        (x * x * x * x * x * x * x * x)
      
      If we try to expand it, it generates a very straightforward sequence of muls, like:
      
        x2 = mul x, x
        x3 = mul x2, x
        x4 = mul x3, x
            ...
        x8 = mul x7, x
      
      This is a non-efficient way of doing that. A better way is to generate a sequence of
      binary power calculation. In this case the expanded calculation will look like:
      
        x2 = mul x, x
        x4 = mul x2, x2
        x8 = mul x4, x4
      
      In some cases the code size reduction for such SCEVs is dramatic. If we had a loop:
      
        x = a;
        for (int i = 0; i < 3; i++)
          x = x * x;
      
      And this loop have been fully unrolled, we have something like:
      
        x = a;
        x2 = x * x;
        x4 = x2 * x2;
        x8 = x4 * x4;
      
      The SCEV for x8 is the same as in example above, and if we for some reason
      want to expand it, we will generate naively 7 multiplications instead of 3.
      The BinPow expansion algorithm here allows to keep code size reasonable.
      
      This patch teaches SCEV Expander to generate a sequence of BinPow multiplications
      if we have repeating arguments in SCEVMulExpressions.
      
      Differential Revision: https://reviews.llvm.org/D34025
      
      llvm-svn: 305663
      35b2a18e
    • David Blaikie's avatar
      [Doc] Fix getelementptr description about arguments · f91b030a
      David Blaikie authored
      Section "Arguments" of `getelementptr` [1] says the first argument is a
      type, the second argument is a pointer or a vector of pointers, and is
      the base address to start from. Update `getelementptr` FAQ [2]
      accordingly, based on discussion with David on the mailing list [3].
      
      [1] http://llvm.org/docs/LangRef.html#getelementptr-instruction
      [2] http://llvm.org/docs/GetElementPtr.html
      [3] http://lists.llvm.org/pipermail/llvm-dev/2017-June/114294.html
      
      Patch by Wei-Ren Chen!
      
      Differential Revision: https://reviews.llvm.org/D34325
      
      llvm-svn: 305662
      f91b030a
    • Duncan P. N. Exon Smith's avatar
      path: Use string_view_t consistently · 8b1b1322
      Duncan P. N. Exon Smith authored
      Most of filesystem/path.cpp uses string_view_t. This fixes the two spots
      that use string_view directly.
      
      https://reviews.llvm.org/D34332
      
      llvm-svn: 305661
      8b1b1322