1. Mar 06, 2018
    • Pavel Labath's avatar
      ObjectFileMachO: split CreateSections mega-function into more manageable chunks · b417eeae
      Pavel Labath authored
      Summary:
      In an effort to understand the function's operation, I've split it into logical
      pieces. Parsing of a single segment is moved to a separate function (and the
      parsing state that is carried from one segment to another is explicitly
      captured in the SegmentParsingContext object). I've also extracted some pieces
      of code which were already standalone (validation of the segment load command,
      determining the section type, determining segment permissions) into
      separate functions.
      
      Parsing of a single section within the segment should probably also be a
      separate function, but I've left that for a separate patch.
      
      This patch is intended to be NFC.
      
      Reviewers: clayborg, davide
      
      Subscribers: lldb-commits
      
      Differential Revision: https://reviews.llvm.org/D44074
      
      llvm-svn: 326791
      b417eeae
    • Nicolai Haehnle's avatar
      TableGen: Add !foldl operation · d34f6843
      Nicolai Haehnle authored
      Change-Id: I63d67bf6e0b315e2d3360e47e3b62c9517f38987
      llvm-svn: 326790
      d34f6843
    • Nicolai Haehnle's avatar
      TableGen: Remove the ResolveFirst mechanism · 61663502
      Nicolai Haehnle authored
      Summary:
      It is no longer used.
      
      Change-Id: I1e47267d1975d43ad43acd6347f54e958e3b6c86
      
      Reviewers: arsenm, craig.topper, tra, MartinO
      
      Subscribers: wdng, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D43757
      
      llvm-svn: 326789
      61663502
    • Nicolai Haehnle's avatar
      TableGen: Delay instantiating inline anonymous records · d4c0a5d0
      Nicolai Haehnle authored
      Summary:
      Only instantiate anonymous records once all variable references in template
      arguments have been resolved. This allows patterns like the new test case,
      which in practice can appear in expressions like:
      
        class IntrinsicTypeProfile<list<LLVMType> ty, int shift> {
          list<LLVMType> types =
            !listconcat(ty, [llvm_any_ty, LLVMMatchType<shift>]);
        }
      
        class FooIntrinsic<IntrinsicTypeProfile P, ...>
          : Intrinsic<..., P.types, ...>;
      
      Without this change, the anonymous LLVMMatchType instantiation would
      never get resolved.
      
      Another consequence of this change is that anonymous inline
      instantiations are uniqued via the folding set of the newly introduced
      VarDefInit.
      
      Change-Id: I7a7041a20e297cf98c9109b28d85e64e176c932a
      
      Reviewers: arsenm, craig.topper, tra, MartinO
      
      Subscribers: wdng, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D43756
      
      llvm-svn: 326788
      d4c0a5d0
    • Nicolai Haehnle's avatar
      TableGen: Move getNewAnonymousName into RecordKeeper · 73355bcd
      Nicolai Haehnle authored
      Summary:
      So that we will be able to generate new anonymous names more easily
      outside the parser as well.
      
      Change-Id: I28f396a7bdbc3ff0c665d466abbd3d31376e21b4
      
      Reviewers: arsenm, craig.topper, tra, MartinO
      
      Subscribers: wdng, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D43755
      
      llvm-svn: 326787
      73355bcd
    • Nicolai Haehnle's avatar
      TableGen: Explicitly check whether a record has been resolved · 0f529885
      Nicolai Haehnle authored
      Summary:
      There are various places where resolving and constant folds can
      get stuck, especially around casts. We don't always signal an
      error for those, because in many cases they can legitimately
      occur without being an error in the "untaken branch" of an !if.
      
      Change-Id: I3befc0e4234c8e6cc61190504702918c9f29ce5c
      
      Reviewers: arsenm, craig.topper, tra, MartinO
      
      Subscribers: wdng, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D43754
      
      llvm-svn: 326786
      0f529885
    • Nicolai Haehnle's avatar
      TableGen: Allow !cast of records, cleanup conversion machinery · dfda9dcc
      Nicolai Haehnle authored
      Summary:
      Distinguish two relationships between types: is-a and convertible-to.
      For example, a bit is not an int or vice versa, but they can be
      converted into each other (with range checks that you can think of
      as "dynamic": unlike other type checks, those range checks do not
      happen during parsing, but only once the final values have been
      established).
      
      Actually converting initializers between types is subtle: even
      when values of type A can be converted to type B (e.g. int into
      string), it may not be possible to do so with a concrete initializer
      (e.g., a VarInit that refers to a variable of type int cannot
      be immediately converted to a string).
      
      For this reason, distinguish between getCastTo and convertInitializerTo:
      the latter implements the actual conversion when appropriate, while
      the former will first try to do the actual conversion and fall back
      to introducing a !cast operation so that the conversion will be
      delayed until variable references have been resolved.
      
      To make the approach of adding !cast operations to work, !cast needs
      to fallback to convertInitializerTo when the special string <-> record
      logic does not apply.
      
      This enables casting records to a subclass, although that new
      functionality is only truly useful together with !isa, which will be
      added in a later change.
      
      The test is removed because it uses !srl on a bit sequence,
      which cannot really be supported consistently, but luckily
      isn't used anywhere either.
      
      Change-Id: I98168bf52649176654ed2ec61a29bdb29970cfe7
      
      Reviewers: arsenm, craig.topper, tra, MartinO
      
      Subscribers: wdng, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D43753
      
      llvm-svn: 326785
      dfda9dcc
    • Nicolai Haehnle's avatar
      TableGen: Simplify BitsInit::resolveReferences · 9a84a509
      Nicolai Haehnle authored
      Summary:
      No functional change intended. The removed code has a loop for
      recursive resolving, which is superseded by the recursive
      resolving done by the Resolver implementations.
      
      Add a test case which was broken by an earlier version of this
      change.
      
      Change-Id: Ib208d037b77a8bbb725977f1388601fc984723d8
      
      Reviewers: arsenm, craig.topper, tra, MartinO
      
      Subscribers: wdng, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D43655
      
      llvm-svn: 326784
      9a84a509
    • Nicolai Haehnle's avatar
      TableGen: Generalize record types to fix typeIsConvertibleTo et al. · 13080fd1
      Nicolai Haehnle authored
      Summary:
      Allow RecordRecTy to represent the type "subclass of N superclasses",
      where N may be zero. Furthermore, generate RecordRecTy instances only
      with actual classes in the list.
      
      Keeping track of multiple superclasses is required to resolve the type
      of a list correctly in some cases. The old code relied on the incorrect
      behavior of typeIsConvertibleTo, and an earlier version of this change
      relied on a modified ordering of superclasses (it was committed in
      r325884 and then reverted because unfortunately some of clang-tblgen's
      backends depend on the ordering).
      
      Previously, the DefInit for each Record would have a RecordRecTy of
      that Record as its type. Now, all defs with the same superclasses will
      share the same type.
      
      This allows us to be more consistent about type checks involving records:
      
      - typeIsConvertibleTo actually requires the LHS to be a subtype of the
        RHS
      
      - resolveTypes will return the least supertype of given record types in
        all cases
      
      - different record types in the two branches of an !if are handled
        correctly
      
      Add a test that used to be accepted without flagging the obvious type
      error.
      
      Change-Id: Ib366db1a4e6a079f1a0851e469b402cddae76714
      
      Reviewers: arsenm, craig.topper, tra, MartinO
      
      Subscribers: wdng, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D43680
      
      llvm-svn: 326783
      13080fd1
    • Henry Wong's avatar
      [analyzer] CStringChecker.cpp: Remove the duplicated check about null... · 945a84a0
      Henry Wong authored
      [analyzer] CStringChecker.cpp: Remove the duplicated check about null dereference on dest-buffer or src-buffer.
      
      Summary: `CheckBufferAccess()` calls `CheckNonNull()`, so there are some calls to `CheckNonNull()` that are useless.
      
      Reviewers: dcoughlin, NoQ, xazax.hun, cfe-commits, george.karpenkov
      
      Reviewed By: NoQ
      
      Subscribers: szepet, rnkovacs, MTC, a.sidorin
      
      Differential Revision: https://reviews.llvm.org/D44075
      
      llvm-svn: 326782
      945a84a0
    • Krasimir Georgiev's avatar
      [clang-format] Fix documentation for SpaceAfterCStyleCast option · c5be6aff
      Krasimir Georgiev authored
      Patch contributed by @EricMarti!
      
      Summary: I noticed that the example for SpaceAfterCStyleCast does not match its description. I fixed the example after testing it out.
      
      Reviewers: rsmith, krasimir
      
      Reviewed By: krasimir
      
      Subscribers: klimek, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D43731
      
      llvm-svn: 326781
      c5be6aff
    • Bjorn Pettersson's avatar
      Fixup for rL326769 (RegState::Debug is being truncated to a bool) · e0050d7f
      Bjorn Pettersson authored
      I obviously messed up arguments to MachineOperand::CreateReg
      in rL326769. This should make it work as intended.
      
      Thanks to RKSimon for spotting this.
      
      llvm-svn: 326780
      e0050d7f
    • Florian Hahn's avatar
      [CloneFunction] Support BB == PredBB in DuplicateInstructionsInSplit. · f0a25f72
      Florian Hahn authored
      In case PredBB == BB and StopAt == BB's terminator, StopAt != &*BI will
      fail, because BB's terminator instruction gets replaced.
      
      By using BB.getTerminator() we get the current terminator which we can use
      to compare.
      
      Reviewers: sanjoy, anna, reames
      
      Reviewed By: anna
      
      Differential Revision: https://reviews.llvm.org/D43822
      
      llvm-svn: 326779
      f0a25f72
    • Haojian Wu's avatar
      [clangd] Fix -Wpedantic warning, NFC. · 33caf899
      Haojian Wu authored
      llvm-svn: 326778
      33caf899
    • Pavel Labath's avatar
      HostThreadPosix::Cancel: remove android-specific implementation · 408b0f53
      Pavel Labath authored
      Noone is calling this function on android, so we can just use the
      generic llvm_unreachable "implementation".
      
      llvm-svn: 326777
      408b0f53
    • Henry Wong's avatar
      [Analyzer] More accurate modeling about the increment operator of the operand with type bool. · e47b89d1
      Henry Wong authored
      Summary:
      There is a problem with analyzer that a wrong value is given when modeling the increment operator of the operand with type bool. After `rL307604` is applied, a unsigned overflow may occur.
      
      Example:
      ```
      void func() {
        bool b = true;
        // unsigned overflow occur, 2 -> 0 U1b
        b++;
      }
      ``` 
      
      The use of an operand of type bool with the ++ operators is deprecated but valid untill C++17. And if the operand of the increment operator is of type bool, it is set to true.
      
      This patch includes two parts:
      
        - If the operand of the increment operator is of type bool or type _Bool, set to true.
        - Modify `BasicValueFactory::getTruthValue()`, use `getIntWidth()` instead `getTypeSize()` and use `unsigned` instead `signed`.
      
      Reviewers: alexshap, NoQ, dcoughlin, george.karpenkov
      
      Reviewed By: NoQ
      
      Subscribers: xazax.hun, szepet, a.sidorin, cfe-commits, MTC
      
      Differential Revision: https://reviews.llvm.org/D43741
      
      llvm-svn: 326776
      e47b89d1
    • Pavel Labath's avatar
      [LLDB][PPC64] Fixed issues with expedited registers · 5e5dd706
      Pavel Labath authored
      Summary:
      - reg_nums were missing the end marker entry
      - marked FP test to be skipped for ppc64
      
      Reviewers: labath, clayborg
      
      Reviewed By: labath, clayborg
      
      Subscribers: alexandreyy, lbianc, nemanjai, kbarton
      
      Differential Revision: https://reviews.llvm.org/D43767
      Patch by Leandro Lupori <leandro.lupori@gmail.com>
      
      llvm-svn: 326775
      5e5dd706
    • Dylan McKay's avatar
      [AVR] Remove the earlyclobber flag from LDDWRdYQ · 8f46486c
      Dylan McKay authored
      Before I started maintaining the AVR backend, this instruction
      never originally used to have an earlyclobber flag.
      
      Some time afterwards (years ago), I must've added it back in, not realising that it
      was left out for a reason.
      
      This pseudo instrction exists solely to work around a long standing bug
      in the register allocator.
      
      Before this commit, the LDDWRdYQ pseudo was not actually working around
      any bug. With the earlyclobber flag removed again, the LDDWRdYQ pseudo
      now correctly works around PR13375 again.
      
      llvm-svn: 326774
      8f46486c
    • Eric Liu's avatar
      [clangd] Sort includes when formatting code or inserting new includes. · e3395b90
      Eric Liu authored
      Reviewers: hokein, ilya-biryukov
      
      Subscribers: klimek, jkorous-apple, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D44138
      
      llvm-svn: 326773
      e3395b90
    • Alexander Kornienko's avatar
      Move test/gcdasyncsemaphorechecker_test.m to a subdirectory · d8ec6e73
      Alexander Kornienko authored
      llvm-svn: 326772
      d8ec6e73
    • Bjorn Pettersson's avatar
      [DebugInfo] Discard invalid DBG_VALUE instructions in LiveDebugVariables · bdf0c001
      Bjorn Pettersson authored
      Summary:
      This is a workaround for pr36417
      https://bugs.llvm.org/show_bug.cgi?id=36417
      
      LiveDebugVariables will now verify that the DBG_VALUE instructions
      are sane (prior to register allocation) by asking LIS if a virtual
      register used in the DBG_VALUE is live (or dead def) in the slot
      index before the DBG_VALUE. If it isn't sane the DBG_VALUE is
      discarded.
      
      One pass that was identified as introducing non-sane DBG_VALUE
      instructtons, when analysing pr36417, was the DAG->DAG Instruction
      Selection. It sometimes inserts DBG_VALUE instructions referring to
      a virtual register that is defined later in the same basic block.
      So it is a use before def kind of problem. The DBG_VALUE is
      typically inserted in the beginning of a basic block when this
      happens. The problem can be seen in the test case
      test/DebugInfo/X86/dbg-value-inlined-parameter.ll
      
      Reviewers: aprantl, rnk, probinson
      
      Reviewed By: aprantl
      
      Subscribers: vsk, davide, alexcrichton, Ka-Ka, eraman, llvm-commits, JDevlieghere
      
      Differential Revision: https://reviews.llvm.org/D43956
      
      llvm-svn: 326769
      bdf0c001
    • Kamil Rytarowski's avatar
      OpenBSD sanitizer common, define RLIMIT_AS constant · 2f358738
      Kamil Rytarowski authored
      Summary: define RLIMIT_AS constant until it s defined in the future
      
      Patch by: David Carlier
      
      Reviewers: krytarowski, vitalybuka
      
      Reviewed By: vitalybuka
      
      Subscribers: kubamracek, llvm-commits, #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D44068
      
      llvm-svn: 326768
      2f358738
    • George Burgess IV's avatar
      Fix an unused variable warning; NFC · a47e1b73
      George Burgess IV authored
      llvm-svn: 326767
      a47e1b73
    • George Burgess IV's avatar
      [ExprConstant] Look through ExprWithCleanups for `allocsize` · 9753b790
      George Burgess IV authored
      llvm-svn: 326766
      9753b790
    • Sam Clegg's avatar
      [WebAssebmly] Remove reloc ordering constraint · fa5a04fb
      Sam Clegg authored
      The MC layer doesn't currently emit relocations in offset
      order for the entire code section so this check was causing
      failures on the wasm waterfall.
      
      Perhaps we can re-instate this check if we divide the relocations
      per-function, or add extra ordering the MC object writer.
      
      Differential Revision: https://reviews.llvm.org/D44136
      
      llvm-svn: 326765
      fa5a04fb
    • Martin Storsjo's avatar
      [X86] Handle EAX being live when calling chkstk for x86_64 · a7adc318
      Martin Storsjo authored
      EAX can turn out to be alive here, when shrink wrapping is done
      (which is allowed when using dwarf exceptions, contrary to the
      normal case with WinCFI).
      
      This fixes PR36487.
      
      Differential Revision: https://reviews.llvm.org/D43968
      
      llvm-svn: 326764
      a7adc318
    • Serge Pavlov's avatar
      Updated docs in CrashRecoveryContext.h · d43c0e1c
      Serge Pavlov authored
      Differential Revision: https://reviews.llvm.org/D43200
      
      llvm-svn: 326763
      d43c0e1c
    • Paul Robinson's avatar
      Revert "[DWARFv5] Emit file 0 to the line table." · 732e443b
      Paul Robinson authored
      Caused an asan failure.
      
      This reverts commit d54883f081186cdcce74e6f98cfc0438579ec019.
      aka r326758
      
      llvm-svn: 326762
      732e443b
    • Xin Tong's avatar
      [MergeICmp] Simplify how BCECmpBlock instructions are blacklisted · 8fd561f5
      Xin Tong authored
      llvm-svn: 326761
      8fd561f5
    • Xin Tong's avatar
      [MergeICmp] Fix printing. NFC · 98af9efc
      Xin Tong authored
      llvm-svn: 326760
      98af9efc
    • Petr Hosek's avatar
      [sanitizer] Fix the return type for GetTid in Fuchsia implementation · 5e3b41d5
      Petr Hosek authored
      This is triggering "functions that differ only in their return type
      cannot be overloaded" error.
      
      Differential Revision: https://reviews.llvm.org/D44126
      
      llvm-svn: 326759
      5e3b41d5
    • Paul Robinson's avatar
      [DWARFv5] Emit file 0 to the line table. · d5069ba3
      Paul Robinson authored
      DWARF v5 specifies that the root file (also given in the DW_AT_name
      attribute of the compilation unit DIE) should be emitted explicitly to
      the line table's list of files.  This makes the line table more
      independent of the .debug_info section.
      
      Differential Revision: https://reviews.llvm.org/D44054
      
      llvm-svn: 326758
      d5069ba3
    • Eugene Zelenko's avatar
      [StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use... · b8b9af2a
      Eugene Zelenko authored
      [StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
      
      llvm-svn: 326757
      b8b9af2a
    • Jason Molenda's avatar
      Upstreaming avx512 register support in debugserver. These changes · a1bd9508
      Jason Molenda authored
      were originally written by Chris Bieneman, they've undergone a
      number of changes since then.
      
      Also including the debugserver bridgeos support, another arm
      environment that runs Darwin akin to ios.  These codepaths are
      activated when running in a bridgeos environment which we're not
      set up to test today.
      
      There's additional (small) lldb changes to handle bridgeos binaries
      that still need to be merged up.
      
      Tested on a darwin system with avx512 hardware and without.
      
      <rdar://problem/36424951> 
      
      llvm-svn: 326756
      a1bd9508
    • George Karpenkov's avatar
      [analyzer] [quickfix] Prevent a crash in NamedDecl::getName() · 15e814f6
      George Karpenkov authored
      llvm-svn: 326755
      15e814f6
    • Adrian Prantl's avatar
      LLDBStandalone.cmake: set path to llvm-lit inside of llvm build dir · 39e54cb7
      Adrian Prantl authored
      llvm-svn: 326754
      39e54cb7
    • Rui Ueyama's avatar
      Remove redundant casts. · 067617f9
      Rui Ueyama authored
      llvm-svn: 326753
      067617f9
    • Reid Kleckner's avatar
      Disable llvm-opt-fuzzer/exec-options.ll on Windows, it is too flaky · 9e0c61b9
      Reid Kleckner authored
      llvm-svn: 326752
      9e0c61b9
    • Simon Pilgrim's avatar
      [X86] cvttpd2dq lowering has been supported for some time · 53ff5ae8
      Simon Pilgrim authored
      Tests in vec_fp_to_int.ll 
      
      llvm-svn: 326751
      53ff5ae8
    • Sanjay Patel's avatar
      [InstSimplify] remove redundant folds · 62a4f5c2
      Sanjay Patel authored
      The 'hasOneUse' check is a giveaway that something's not right.
      We never need to check that in InstSimplify because we don't
      create new instructions here.
      
      These are all handled as icmp simplifies which then trigger
      existing select simplifies, so there's no need to duplicate 
      a composite fold of the two.
      
      llvm-svn: 326750
      62a4f5c2