1. Aug 01, 2018
    • Jonas Devlieghere's avatar
      [DebugInfo] Remove ambiguity to fix Windows bots · f73205b0
      Jonas Devlieghere authored
      Should fix the MSVC bots by explicitly invoking
      llvm::make_reverse_iterator to remove ambiguity with
      std::make_reverse_iterator.
      
      llvm-svn: 338511
      f73205b0
    • Simon Pilgrim's avatar
      Add missing semicolon. · 080b8709
      Simon Pilgrim authored
      llvm-svn: 338510
      080b8709
    • Jonas Devlieghere's avatar
      [DebugInfo] Improve consistency in DWARFDie.h (NFC) · 2c045cf9
      Jonas Devlieghere authored
      Follow-up for r338506 with some unrelated changes in formatting and
      consistency.
      
      llvm-svn: 338509
      2c045cf9
    • Simon Pilgrim's avatar
      3c6cb405
    • Andrew V. Tischenko's avatar
      [X86] Improved sched models for X86 BT*rr instructions. · dad919d3
      Andrew V. Tischenko authored
      Differential Revision: https://reviews.llvm.org/D49243
      
      llvm-svn: 338507
      dad919d3
    • Jonas Devlieghere's avatar
      [DebugInfo] Have custom std::reverse_iterator<DWARFDie> · 3a04bea9
      Jonas Devlieghere authored
      The DWARFDie is a lightweight utility wrapper that stores a pointer to a
      compile unit and a debug info entry. Currently, its iterator (used for
      walking over its children) stores a DWARFDie and returns a const
      reference when dereferencing it.
      
      When the iterator is modified (by incrementing or decrementing it), this
      reference becomes invalid. This was happening when calling reverse on
      it, because the std::reverse_iterator is keeping a temporary copy of the
      iterator (see
      https://en.cppreference.com/w/cpp/iterator/reverse_iterator for a good
      illustration).
      
      The relevant code in libcxx:
      
        reference operator*() const {_Iter __tmp = current; return *--__tmp;}
      
      When dereferencing the reverse iterator, we decrement and return a
      reference to a DWARFDie stored in the stack frame of this function,
      resulting in UB at runtime.
      
      This patch specifies the std::reverse_iterator for DWARFDie to do the
      right thing.
      
      Differential revision: https://reviews.llvm.org/D49679
      
      llvm-svn: 338506
      3a04bea9
    • Tobias Grosser's avatar
      [isl++] drop the isl namespace qualifiers [NFC] · 4b53d74e
      Tobias Grosser authored
      These namespace qualifiers are not needed. Dropping them brings us
      closer to the official isl namespace qualifiers.
      
      While the delta of this change set is large, it only mechanically drops
      the 'isl::' prefixes.
      
      llvm-svn: 338505
      4b53d74e
    • Tobias Grosser's avatar
      Rebase C++ bindings on top of latest isl bindings · a2fd4419
      Tobias Grosser authored
      The main difference in this change is that isl_stat is now always
      checked by default. As we elminiated most used of isl_stat, thanks to
      Philip Pfaffe's implementation of foreach, only a small set of changes
      is needed.
      
      This change does not include the following recent changes to isl's C++
      bindings:
      
        - stricter error handling for isl_bool
        - dropping of the isl::namespace qualifiers
      
      The former requires a larger patch in Polly and consequently should go
      through a patch-review. The latter will be applied in the next commit to
      keep this commit free from noise.
      
      We also still apply a couple of other changes on top of the official isl
      bindings. This delta is expected to shrink over time.
      
      llvm-svn: 338504
      a2fd4419
    • Yuka Takahashi's avatar
      [Modules] Do not emit relocation error when -fno-validate-pch is set · d8baec2f
      Yuka Takahashi authored
      Summary:
      Clang emits error when implicit modules was relocated from the
      first build directory. However this was biting our usecase where we copy
      the contents of build directory to another directory in order to
      distribute.
      
      Differential Revision: https://reviews.llvm.org/D49852
      
      llvm-svn: 338503
      d8baec2f
    • Simon Pilgrim's avatar
      Fix "not all control paths return a value" MSVC warning. · 8aca1c8d
      Simon Pilgrim authored
      llvm-svn: 338502
      8aca1c8d
    • Tobias Grosser's avatar
      Update to isl-0.20-35-ge0a98b62 · d169d70b
      Tobias Grosser authored
      llvm-svn: 338501
      d169d70b
    • Marco Castelluccio's avatar
      [gcov] Add test which uses fork · 85ae51ed
      Marco Castelluccio authored
      Test for https://bugs.llvm.org/show_bug.cgi?id=38180.
      
      llvm-svn: 338500
      85ae51ed
    • Petar Jovanovic's avatar
      [MIPS GlobalISel] Select global address · 64c10ba8
      Petar Jovanovic authored
      Select G_GLOBAL_VALUE for position dependent code.
      
      Patch by Petar Avramovic.
      
      Differential Revision: https://reviews.llvm.org/D49803
      
      llvm-svn: 338499
      64c10ba8
    • George Rimar's avatar
      [LLD][ELF] - Apply clang-format to InputSections.cpp. NFC. · 676dc17d
      George Rimar authored
      llvm-svn: 338498
      676dc17d
    • George Rimar's avatar
      [LLD][ELF] - Removed excessive llvm:: prefix. NFC. · a4211551
      George Rimar authored
      llvm-svn: 338497
      a4211551
    • David Bolvansky's avatar
      Revert "Enrich inline messages", tests fail · fbbb83c7
      David Bolvansky authored
      llvm-svn: 338496
      fbbb83c7
    • Hans Wennborg's avatar
      Add llvm-rc to LLVM_TOOLCHAIN_TOOLS (PR38386) · f23db0d7
      Hans Wennborg authored
      This means it will be installed also in builds configured with
      LLVM_INSTALL_TOOLCHAIN_ONLY, such as the Windows packages.
      
      llvm-svn: 338495
      f23db0d7
    • David Bolvansky's avatar
      Enrich inline messages · 7f36cd9d
      David Bolvansky authored
      Summary:
      This patch improves Inliner to provide causes/reasons for negative inline decisions.
      1. It adds one new message field to InlineCost to report causes for Always and Never instances. All Never and Always instantiations must provide a simple message.
      2. Several functions that used to return the inlining results as boolean are changed to return InlineResult which carries the cause for negative decision.
      3. Changed remark priniting and debug output messages to provide the additional messages and related inline cost.
      4. Adjusted tests for changed printing.
      
      Patch by: yrouban (Yevgeny Rouban)
      
      
      Reviewers: craig.topper, sammccall, sgraenitz, NutshellySima, shchenz, chandlerc, apilipenko, javed.absar, tejohnson, dblaikie, sanjoy, eraman, xbolva00
      
      Reviewed By: tejohnson, xbolva00
      
      Subscribers: xbolva00, llvm-commits, arsenm, mehdi_amini, eraman, haicheng, steven_wu, dexonsmith
      
      Differential Revision: https://reviews.llvm.org/D49412
      
      llvm-svn: 338494
      7f36cd9d
    • Martin Storsjo's avatar
      [AArch64] Disallow the MachO specific .loh directive for windows · d4590c38
      Martin Storsjo authored
      Also add a test for it being unsupported for linux.
      
      Differential Revision: https://reviews.llvm.org/D49929
      
      llvm-svn: 338493
      d4590c38
    • Craig Topper's avatar
      [X86] When looking for (CMOV C-1, (ADD (CTTZ X), C), (X != 0)) -> (ADD (CMOV... · 65a13888
      Craig Topper authored
      [X86] When looking for (CMOV C-1, (ADD (CTTZ X), C), (X != 0)) -> (ADD (CMOV (CTTZ X), -1, (X != 0)), C), make sure we really have a compare with 0.
      
      It's not strictly required by the transform of the cmov and the add, but it makes sure we restrict it to the cases we know we want to match.
      
      While there canonicalize the operand order of the cmov to simplify the matching and emitting code.
      
      llvm-svn: 338492
      65a13888
    • Raphael Isemann's avatar
      Removed failing StreamTest case · 7dd0aba0
      Raphael Isemann authored
      The suspicious behavior is obviously because this method reads
      OOB memory, so I'll remove it for now and re-add the test alongside
      the fix later.
      
      llvm-svn: 338491
      7dd0aba0
    • Jonas Hahnfeld's avatar
      [test] Convert test for PR36720 to c89 · 51fc3cc6
      Jonas Hahnfeld authored
      GCC 4.8.5 defaults to this old C standard. I think we should make the
      tests pass a newer -std=c99|c11 but that's too intrusive for now...
      
      Differential Revision: https://reviews.llvm.org/D50084
      
      llvm-svn: 338490
      51fc3cc6
    • Roman Lebedev's avatar
      [AST] CastExpr: BasePathSize is not large enough. · 4aaf1dca
      Roman Lebedev authored
      Summary:
      rC337815 / D49508 had to cannibalize one bit of `CastExprBitfields::BasePathSize` in order to squeeze `PartOfExplicitCast` boolean.
      That reduced the maximal value of `PartOfExplicitCast` from 9 bits (~512) down to 8 bits (~256).
      Apparently, that mattered. Too bad there weren't any tests.
      It caused [[ https://bugs.llvm.org/show_bug.cgi?id=38356 | PR38356 ]].
      
      So we need to increase `PartOfExplicitCast` back at least to 9 bits, or a bit more.
      For obvious reasons, we can't do that in `CastExprBitfields` - that would blow up the size of every `Expr`.
      So we need to either just add a variable into the `CastExpr` (as done here),
      or use `llvm::TrailingObjects`. The latter does not seem to be straight-forward.
      Perhaps, that needs to be done not for the `CastExpr` itself, but for all of it's `final` children.
      
      Reviewers: rjmccall, rsmith, erichkeane
      
      Reviewed By: rjmccall
      
      Subscribers: bricci, hans, cfe-commits, waddlesplash
      
      Differential Revision: https://reviews.llvm.org/D50050
      
      llvm-svn: 338489
      4aaf1dca
    • Raphael Isemann's avatar
      Added initial unit test for LLDB's Stream class. · b1dfad06
      Raphael Isemann authored
      Summary:
      This adds an initial small unit test for LLDB's Stream class, which should at least cover
      most of the functions in the Stream class. StreamString is always in big endian
      mode, so that's the only stream byte order path this test covers as of now. Also,
      the binary mode still needs to be tested for all print methods.
      
      Also adds some FIXMEs for wrong/strange result values of the Stream class that we hit
      while testing those functions.
      
      Reviewers: labath
      
      Reviewed By: labath
      
      Subscribers: probinson, labath, mgorny, lldb-commits
      
      Differential Revision: https://reviews.llvm.org/D50027
      
      llvm-svn: 338488
      b1dfad06
    • Victor Leschuk's avatar
      [DWARF] Basic support for producing DWARFv5 .debug_addr section · 64e0c567
      Victor Leschuk authored
      This revision implements support for generating DWARFv5 .debug_addr section.
      The implementation is pretty straight-forward: we just check the dwarf version
      and emit section header if needed.
      
      Reviewers: aprantl, dblaikie, probinson
      
      Reviewed by: dblaikie
      
      Differential Revision: https://reviews.llvm.org/D50005
      
      llvm-svn: 338487
      64e0c567
    • Zhihao Yuan's avatar
      [libc++] Fix build failures after merging <charconv> · 63ebd3bd
      Zhihao Yuan authored
      Summary:
      - fix a stupid unit test typo
      - add <charconv> symbols to Linux abilist
      
      Reviewers: EricWF
      
      Subscribers: christof, ldionne, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D50130
      
      llvm-svn: 338486
      63ebd3bd
    • Hiroshi Inoue's avatar
      [InstSimplify] fold extracting from std::pair (1/2) · 02f79eae
      Hiroshi Inoue authored
      This patch intends to enable jump threading when a method whose return type is std::pair<int, bool> or std::pair<bool, int> is inlined.
      For example, jump threading does not happen for the if statement in func.
      
      std::pair<int, bool> callee(int v) {
        int a = dummy(v);
        if (a) return std::make_pair(dummy(v), true);
        else return std::make_pair(v, v < 0);
      }
      
      int func(int v) {
        std::pair<int, bool> rc = callee(v);
        if (rc.second) {
          // do something
        }
      
      SROA executed before the method inlining replaces std::pair by i64 without splitting in both callee and func since at this point no access to the individual fields is seen to SROA.
      After inlining, jump threading fails to identify that the incoming value is a constant due to additional instructions (like or, and, trunc).
      
      This series of patch add patterns in InstructionSimplify to fold extraction of members of std::pair. To help jump threading, actually we need to optimize the code sequence spanning multiple BBs.
      These patches does not handle phi by itself, but these additional patterns help NewGVN pass, which calls instsimplify to check opportunities for simplifying instructions over phi, apply phi-of-ops optimization to result in successful jump threading. 
      SimplifyDemandedBits in InstCombine, can do more general optimization but this patch aims to provide opportunities for other optimizers by supporting a simple but common case in InstSimplify.
      
      This first patch in the series handles code sequences that merges two values using shl and or and then extracts one value using lshr.
      
      Differential Revision: https://reviews.llvm.org/D48828
      
      llvm-svn: 338485
      02f79eae
    • Hsiangkai Wang's avatar
      [DebugInfo] Fix build failed in clang-x86_64-linux-selfhost-modules. · 2089e4c8
      Hsiangkai Wang authored
      Only generate symbol difference expression if needed.
      
      llvm-svn: 338484
      2089e4c8
    • Jatin Bhateja's avatar
      [X86] Adding more test patterns for lea-opt (PR37939) · 36432a70
      Jatin Bhateja authored
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D50128
      
      llvm-svn: 338483
      36432a70
    • Petr Hosek's avatar
      [OpenEmbedded] Explicitly specify -rtlib in tests · 78c20a85
      Petr Hosek authored
      Tests added in r338294 implicitly assume that libgcc is the runtime library,
      but that's not the case when the user configures Clang to use compiler-rt in
      which case these tests will break. Explicitly request libgcc when invoking
      clang in these tests to avoid that.
      
      Differential Revision: https://reviews.llvm.org/D50123
      
      llvm-svn: 338482
      78c20a85
    • Chandler Carruth's avatar
      [x86] Fix a really subtle miscompile due to a somewhat glaring bug in · 2ce191e2
      Chandler Carruth authored
      EFLAGS copy lowering.
      
      If you have a branch of LLVM, you may want to cherrypick this. It is
      extremely unlikely to hit this case empirically, but it will likely
      manifest as an "impossible" branch being taken somewhere, and will be
      ... very hard to debug.
      
      Hitting this requires complex conditions living across complex control
      flow combined with some interesting memory (non-stack) initialized with
      the results of a comparison. Also, because you have to arrange for an
      EFLAGS copy to be in *just* the right place, almost anything you do to
      the code will hide the bug. I was unable to reduce anything remotely
      resembling a "good" test case from the place where I hit it, and so
      instead I have constructed synthetic MIR testing that directly exercises
      the bug in question (as well as the good behavior for completeness).
      
      The issue is that we would mistakenly assume any SETcc with a valid
      condition and an initial operand that was a register and a virtual
      register at that to be a register *defining* SETcc...
      
      It isn't though....
      
      This would in turn cause us to test some other bizarre register,
      typically the base pointer of some memory. Now, testing this register
      and using that to branch on doesn't make any sense. It even fails the
      machine verifier (if you are running it) due to the wrong register
      class. But it will make it through LLVM, assemble, and it *looks*
      fine... But wow do you get a very unsual and surprising branch taken in
      your actual code.
      
      The fix is to actually check what kind of SETcc instruction we're
      dealing with. Because there are a bunch of them, I just test the
      may-store bit in the instruction. I've also added an assert for sanity
      that ensure we are, in fact, *defining* the register operand. =D
      
      llvm-svn: 338481
      2ce191e2
    • Chandler Carruth's avatar
      [x86/slh] Add unwind info to several tests to make it more obvious that · 014047a9
      Chandler Carruth authored
      we aren't incorrectly generating any of it when doing SLH.
      
      There was a bug that only occured with SLH that very much looked like it
      could be caused by bad unwind info, and so this was a prime suspect.
      Turns out that everything is fine, but this way we'll *see* if we end
      up, for example, putting things we shouldn't inside the prolog.
      
      llvm-svn: 338480
      014047a9
    • Zhihao Yuan's avatar
      [libc++][C++17] Elementary string conversions for integral types · d2748964
      Zhihao Yuan authored
      Summary:
      Major QoI considerations:
      
      - The facility is backported to C++14, same as libstdc++.
      - Efforts have been made to minimize the header dependencies.
      - The design is friendly to the uses of MSVC intrinsics (`__emulu`, `_umul128`, `_BitScanForward`, `_BitScanForward64`) but not implemented; future contributions are welcome.
      
      Thanks to Milo Yip for contributing the implementation of `__u64toa` and `__u32toa`.
      
      References:
       https://wg21.link/p0067r5
       https://wg21.link/p0682r1
      
      Reviewers: mclow.lists, EricWF
      
      Reviewed By: mclow.lists
      
      Subscribers: ldionne, Quuxplusone, christof, mgorny, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D41458
      
      llvm-svn: 338479
      d2748964
    • Richard Smith's avatar
      Work around GCC miscompile exposed by r338464. · 1dd9501b
      Richard Smith authored
      See gcc.gnu.org/PR86769 for details of the bug.
      
      llvm-svn: 338478
      1dd9501b
    • Hsiangkai Wang's avatar
      [DebugInfo] Generate fixups as emitting DWARF .debug_line. · 5c63af0d
      Hsiangkai Wang authored
      It is necessary to generate fixups in .debug_line as relaxation is
      enabled due to the address delta may be changed after relaxation.
      
      DWARF will record the mappings of lines and addresses in
      .debug_line section. It will encode the information using special
      opcodes, standard opcodes and extended opcodes in Line Number
      Program. I use DW_LNS_fixed_advance_pc to encode fixed length
      address delta and DW_LNE_set_address to encode absolute address
      to make it possible to generate fixups in .debug_line section.
      
      Differential Revision: https://reviews.llvm.org/D46850
      
      llvm-svn: 338477
      5c63af0d
    • Amara Emerson's avatar
      [GlobalISel][IRTranslator] Use RPO traversal when visiting blocks to translate. · 6cdfe29d
      Amara Emerson authored
      Previously we were just visiting the blocks in the function in IR order, which
      is rather arbitrary. Therefore we wouldn't always visit defs before uses, but
      the translation code relies on this assumption in some places.
      
      Only codegen change seen in tests is an elision of a redundant copy.
      
      Fixes PR38396
      
      llvm-svn: 338476
      6cdfe29d
    • Louis Dionne's avatar
      [libc++] Remove _LIBCPP_BUILDING_XXX macros, which are redundant since _LIBCPP_BUILDING_LIBRARY · c8e84ff2
      Louis Dionne authored
      Summary: As suggested by Marshall in https://reviews.llvm.org/D49914
      
      Reviewers: mclow.lists, EricWF
      
      Subscribers: christof, dexonsmith, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D50008
      
      llvm-svn: 338475
      c8e84ff2
    • Artem Dergachev's avatar
      [analyzer] CallEvent: Add helper methods for obtaining the callee stack frame. · b21b4796
      Artem Dergachev authored
      Newly added methods allow reasoning about the stack frame of the call (as
      opposed to the stack frame on which the call was made, which was always
      available) - obtain the stack frame context, obtain parameter regions - even if
      the call is not going to be (or was not) inlined, i.e. even if the analysis
      has never actually entered the stack frame.
      
      Differential Revision: https://reviews.llvm.org/D49715
      
      llvm-svn: 338474
      b21b4796
    • Richard Smith's avatar
      Speculative fix for buildbot failures after r338464. · c4581f4e
      Richard Smith authored
      llvm-svn: 338473
      c4581f4e
    • Erik Pilkington's avatar
      First half of C++17's splicing maps and sets · b0386a51
      Erik Pilkington authored
      This commit adds a node handle type, (located in __node_handle), and adds
      extract() and insert() members to all map and set types, as well as their
      implementations in __tree and __hash_table.
      
      The second half of this feature is adding merge() members, which splice nodes
      in bulk from one container into another. This will be committed in a follow-up.
      
      Differential revision: https://reviews.llvm.org/D46845
      
      llvm-svn: 338472
      b0386a51