1. Jul 21, 2019
    • Raphael Isemann's avatar
      [lldb] Fix crash when looking up type coming from the ClangModuleDeclVendor · ca9dfdfa
      Raphael Isemann authored
      Summary:
      We assume in LLDB that every type comes from an ASTContext with an associated ClangASTContext.
      However the types inside the ClangModuleDeclVendor don't have a ClangASTContext so we end up
      crashing whenever we create a CompilerType for one of these types.
      
      Simplest way to trigger this bug is to just look up NSObject from a module:
         (lldb) expr @import Foundation
         (lldb) type lookup NSObject
         Assertion failed: (m_type_system != nullptr), function CompilerType, file /Users/teemperor/llvm1/llvm-project/lldb/source/Symbol/CompilerType.cpp, line 39.
      
      This patch just creates a ClangASTContext for the ASTContext used by ClangModuleDeclVendor.
      
      Reviewers: davide, shafik
      
      Reviewed By: davide
      
      Subscribers: lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D64989
      
      llvm-svn: 366653
      ca9dfdfa
    • Roman Lebedev's avatar
      8a431874
    • Nathan Lanza's avatar
      [NativePDB] Make GetOrCreateDeclForUid return an lldb CompilerDecl · fe1b8a09
      Nathan Lanza authored
      We intend to make PdbAstBuilder abstract and implement
      PdbAstBuilderClang along with any other languages that wish to use
      PDBs. Thus, change GetOrCreateDeclForUid from returning a clang decl
      to a lldb_private::CompilerDecl.
      
      llvm-svn: 366650
      fe1b8a09
    • Craig Topper's avatar
      [InstCombine] Remove insertRangeTest code that handles the equality case. · 1d149d08
      Craig Topper authored
      For equality, the function called getTrue/getFalse with the VT
      of the comparison input. But getTrue/getFalse need the boolean VT.
      So if this code ever executed, it would assert.
      
      I believe these cases are removed by InstSimplify so we don't get here.
      
      So this patch just fixes up an assert to exclude the equality
      possibility and removes the broken code.
      
      llvm-svn: 366649
      1d149d08
    • Craig Topper's avatar
      [InstCombine] Don't use AddOne/SubOne to see if two APInts are 1 apart. Use... · 8fabdfe9
      Craig Topper authored
      [InstCombine] Don't use AddOne/SubOne to see if two APInts are 1 apart. Use APInt operations instead. NFCI
      
      AddOne/SubOne create new Constant objects. That seems heavy for
      comparing ConstantInts which wrap APInts. Just do the math on
      on the APInts and compare them.
      
      llvm-svn: 366648
      8fabdfe9
    • Yuanfang Chen's avatar
      [lldb] Fix buildbot build fail caused by r366645 · b4e06328
      Yuanfang Chen authored
      llvm-svn: 366647
      b4e06328
    • Nico Weber's avatar
      gn build: Merge r366622 · b9109562
      Nico Weber authored
      llvm-svn: 366646
      b9109562
    • Yuanfang Chen's avatar
      [Clang] Replace cc1 options '-mdisable-fp-elim' and '-momit-leaf-frame-pointer' · ff22ec3d
      Yuanfang Chen authored
      with '-mframe-pointer'
      
      After D56351 and D64294, frame pointer handling is migrated to tri-state
      (all, non-leaf, none) in clang driver and on the function attribute.
      This patch makes the frame pointer handling cc1 option tri-state.
      
      Reviewers: chandlerc, rnk, t.p.northover, MaskRay
      
      Reviewed By: MaskRay
      
      Differential Revision: https://reviews.llvm.org/D56353
      
      llvm-svn: 366645
      ff22ec3d
    • Petr Hosek's avatar
      [ELF] Support explicitly overriding relocation model in LTO · ae4c30a4
      Petr Hosek authored
      lld currently selects the relocation model automatically depending on
      the link flags specified, but in some cases it'd be useful to allow
      explicitly overriding the relocation model using a flag.
      
      llvm-svn: 366644
      ae4c30a4
    • Roman Lebedev's avatar
      [NFC][InstCombine] Autogenerate a few tests · a2dd672c
      Roman Lebedev authored
      llvm-svn: 366643
      a2dd672c
    • Roman Lebedev's avatar
    • Roman Lebedev's avatar
      [NFC][Codegen][X86][AArch64] Add "(x s% C) == 0" tests · 7f0c2357
      Roman Lebedev authored
      Much like with `urem`, the same optimization (albeit with slightly
      different algorithm) applies for the signed case, too.
      
      I'm simply copying the test coverage from `urem` case for now,
      i believe it should be (close to?) sufficient.
      
      llvm-svn: 366640
      7f0c2357
    • Saleem Abdulrasool's avatar
      build: allow the user to specify `llvm-tblgen` · e97f2f33
      Saleem Abdulrasool authored
      This follows the same pattern as Clang and permits the user to specify
      the tablegen to use via `-DLLVM_TABLEGEN=`.  This allows for
      cross-compiling LLDB for a foreign target (e.g. Windows ARM64 on Windows
      X64).  The LLVM dependency for LLDB in that case must be a Windows ARM64
      build which cannot cross-compile llvm-tblgen due to the way that Visual
      Studio works.  Instead, permit the user to have a separate tablegen
      build which can be used during the build.
      
      llvm-svn: 366639
      e97f2f33
    • Serge Guelton's avatar
      Fix asan infinite loop on undefined symbol · a30a4a35
      Serge Guelton authored
      Fix llvm#39641
      
      Recommit of r366413
      
      Differential Revision: https://reviews.llvm.org/D63877
      
      > llvm-svn: 366632
      
      llvm-svn: 366638
      a30a4a35
    • Roman Lebedev's avatar
      [Codegen][SelectionDAG] X u% C == 0 fold: non-splat vector improvements · cd9b1948
      Roman Lebedev authored
      Summary:
      Four things here:
      1. Generalize the fold to handle non-splat divisors. Reasonably trivial.
      2. Unban power-of-two divisors. I don't see any reason why they should
         be illegal.
         * There is no ban in Hacker's Delight
         * I think the ban came from the same bug that caused the miscompile
            in the base patch - in `floor((2^W - 1) / D)` we were dividing by
            `D0` instead of `D`, and we **were** ensuring that `D0` is not `1`,
            which made sense.
      3. Unban `1` divisors. I no longer believe Hacker's Delight actually says
         that the fold is invalid for `D = 0`. Further considerations:
         * We know that
           * `(X u% 1) == 0`  can be constant-folded to `1`,
           * `(X u% 1) != 0`  can be constant-folded to `0`,
         *  Also, we know that
           * `X u<= -1` can be constant-folded to `1`,
           * `X u>  -1` can be constant-folded to `0`,
         * https://godbolt.org/z/7jnZJX https://rise4fun.com/Alive/oF6p
         * We know will end up with the following:
             `(setule/setugt (rotr (mul N, P), K), Q)`
         * Therefore, for given new DAG nodes and comparison predicates
           (`ule`/`ugt`), we will still produce the correct answer if:
           `Q` is a all-ones constant; and both `P` and `K` are *anything*
           other than `undef`.
         * The fold will indeed produce `Q = all-ones`.
      4. Try to re-splat the `P` and `K` vectors - we don't care about
         their values for the lanes where divisor was `1`.
      
      Reviewers: RKSimon, hermord, craig.topper, spatel, xbolva00
      
      Reviewed By: RKSimon
      
      Subscribers: hiraditya, javed.absar, dexonsmith, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D63963
      
      llvm-svn: 366637
      cd9b1948
  2. Jul 20, 2019