1. Dec 06, 2019
    • Greg Clayton's avatar
      Add lookup functions for efficient lookups of addresses when using GsymReader classes. · aeda128a
      Greg Clayton authored
      Summary:
      Lookup functions are designed to not fully decode a FunctionInfo, LineTable or InlineInfo, they decode only what is needed into a LookupResult object. This allows lookups to avoid costly memory allocations and avoid parsing large amounts of information one a suitable match is found.
      
      LookupResult objects contain the address that was looked up, the concrete function address range, the name of the concrete function, and a list of source locations. One for each inline function, and one for the concrete function. This allows one address to turn into multiple frames and improves the signal you get when symbolicating addresses in GSYM files.
      
      Reviewers: labath, aprantl
      
      Subscribers: mgorny, hiraditya, llvm-commits, lldb-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D70993
      aeda128a
    • Sterling Augustine's avatar
      Revert "[AST] Traverse the class type loc inside the member type loc." · 64704978
      Sterling Augustine authored
      This reverts commit 7f93cb62.
      
      The assertion at RecursiveASTVisitor.h:1169 fails when passed a TypeLocNode.
      Not sure if the correct fix is to use getTypeLocClass or something else.
      64704978
    • Teresa Johnson's avatar
      [ThinLTO] Add option to disable readonly/writeonly attribute propagation · 54a3c2a8
      Teresa Johnson authored
      Summary:
      Add an option to allow the attribute propagation on the index to be
      disabled, to allow a workaround for issues (such as that fixed by
      D70977).
      
      Also move the setting of the WithAttributePropagation flag on the index
      into propagateAttributes(), and remove some old stale code that predated
      this flag and cleared the maybe read/write only bits when we need to
      disable the propagation (previously only when importing disabled, now
      also when the new option disables it).
      
      Reviewers: evgeny777, steven_wu
      
      Subscribers: mehdi_amini, inglorion, hiraditya, dexonsmith, arphaman, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D70984
      54a3c2a8
    • Quentin Colombet's avatar
      [RegisterCoalescer] Fix the creation of subranges when rematerialization is used · 2ec71ea7
      Quentin Colombet authored
      * Context *
      
      During register coalescing, we use rematerialization when coalescing is not
      possible. That means we may rematerialize a super register when only a smaller
      register is actually used.
      E.g.,
      0B v1 = ldimm 0xFF
      1B v2 = COPY v1.low8bits
      2B   = v2
      =>
      0B v1 = ldimm 0xFF
      1B v2 = ldimm 0xFF
      2B   = v2.low8bits
      
      Where xB are the slot indexes.
      Here v2 grew from a 8-bit register to a 16-bit register.
      
      When that happens and subregister liveness is enabled, we create subranges for
      the newly created value.
      E.g., before remat, the live range of v2 looked like:
      main range: [1r, 2r)
      (Reads v2 is defined at index 1 slot register and used before the slot register
      of index 2)
      
      After remat, it should look like:
      main range: [1r, 2r)
      low 8 bits: [1r, 2r)
      high 8 bits: [1r, 1d) <-- dead def
      
      I.e., the unsused lanes of v2 should be marked as dead definition.
      
      * The Problem *
      
      Prior to this patch, the live-ranges from the previous exampel, would have the
      full live-range for all subranges:
      main range: [1r, 2r)
      low 8 bits: [1r, 2r)
      high 8 bits: [1r, 2r) <-- too long
      
      * The Fix *
      
      Technically, the code that this patch changes is not wrong:
      When we create the subranges for the newly rematerialized value, we create only
      one subrange for the whole bit mask.
      In other words, at this point v2 live-range looks like this:
      main range: [1r, 2r)
      low & high: [1r, 2r)
      
      Then, it gets wrong when we call LiveInterval::refineSubRanges on low 8 bits:
      main range: [1r, 2r)
      low 8 bits: [1r, 2r)
      high 8 bits: [1r, 2r) <-- too long
      
      Ideally, we would like LiveInterval::refineSubRanges to be able to do the right
      thing and mark the dead lanes as such. However, this is not possible, because by
      the time we update / refine the live ranges, the IR hasn't been updated yet,
      therefore we actually don't have enough information to do the right thing.
      
      Another option to fix the problem would have been to call
      LiveIntervals::shrinkToUses after the IR is updated. This is not desirable as
      this may have a noticeable impact on compile time.
      
      Instead, what this patch does is when we create the subranges for the
      rematerialized value, we explicitly create one subrange for the lanes that were
      used before rematerialization and one for the lanes that were not used. The used
      one inherits the live range of the main range and the unused one is just created
      empty. The existing rematerialization code then detects that the unused one are
      not live and it correctly sets dead def intervals for them.
      
      https://llvm.org/PR41372
      2ec71ea7
    • Reid Kleckner's avatar
      Handle two corner cases in creduce-clang-crash.py · 1f822f21
      Reid Kleckner authored
      Summary:
      First, call os.path.normpath on the filename argument. I passed in
      ./foo-asdf.cpp, and this meant that the script failed to find the
      filename, and bad things happened.
      
      Second, call os.path.abspath on binaries. CReduce runs the
      interestingness test in a temp dir, so relative paths will not work.
      
      Reviewers: akhuang
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D71098
      1f822f21
    • Wenlei He's avatar
      [AutoFDO] Top-down Inlining for specialization with context-sensitive profile · 532196d8
      Wenlei He authored
      Summary:
      AutoFDO's sample profile loader processes function in arbitrary source code order, so if I change the order of two functions in source code, the inline decision can change. This also prevented the use of context-sensitive profile to do specialization while inlining. This commit enforces SCC top-down order for sample profile loader. With this change, we can now do specialization, as illustrated by the added test case:
      
      Say if we have A->B->C and D->B->C call path, we want to inline C into B when root inliner is B, but not when root inliner is A or D, this is not possible without enforcing top-down order. E.g. Once C is inlined into B, A and D can only choose to inline (B->C) as a whole or nothing, but what we want is only inline B into A and D, not its recursive callee C. If we process functions in top-down order, this is no longer a problem, which is what this commit is doing.
      
      This change is guarded with a new switch "-sample-profile-top-down-load" for tuning, and it depends on D70653. Eventually, top-down can be the default order for sample profile loader.
      
      Reviewers: wmi, davidxl
      
      Subscribers: hiraditya, llvm-commits, tejohnson
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D70655
      532196d8
    • Wenlei He's avatar
      [AutoFDO] Properly merge context-sensitive profile of inlinee back to outlined function · e503fd85
      Wenlei He authored
      Summary:
      When sample profile loader decides not to inline a previously inlined call-site, we adjust the profile of outlined function simply by scaling up its profile counts by call-site count. This means the context-sensitive profile of that inlined instance will be thrown away. This commit try to keep context-sensitive profile for such cases:
      
       - Instead of scaling outlined function's profile, we now properly merge the FunctionSamples of inlined instance into outlined function, including all recursively inlined profile.
       - Instead of adjusting the profile for negative inline decision at the end of the sample profile loader pass, we do the profile merge right after processing each function. This change paired with top-down ordering of annotation/inline-replay (a separate diff) will make sure we recursively merge profile back before the profile is used for annotation and inline replay.
      
      A new switch -sample-profile-merge-inlinee is added to enable the new profile merge for tuning. It should be the default behavior eventually.
      
      Reviewers: wmi, davidxl
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D70653
      e503fd85
    • LLVM GN Syncbot's avatar
      gn build: Merge fdf80e86 · 6e8322de
      LLVM GN Syncbot authored
      6e8322de
    • Saar Raz's avatar
      [Concepts] Fix build failures in D41569 · e7c24667
      Saar Raz authored
      Fix build failures in previous commit.
      e7c24667
    • Jordan Rupprecht's avatar
      [lldb] Update hardcoded Makefile.rules inclusions. · 0d236d8b
      Jordan Rupprecht authored
      This replaces `include $(LEVEL)/Makefile.rules` with `include Makefile.rules`.
      The lldb test driver already passes the include path when running make, and specifically looking for "../../Makefile.rules" forces the test to be in a specific location.
      Removing this hardcoded relative path will make it possible to move this test as-is.
      0d236d8b
    • Saar Raz's avatar
      [Concepts] Constraint Enforcement & Diagnostics · fdf80e86
      Saar Raz authored
      Part of the C++20 concepts implementation effort.
      - Associated constraints (requires clauses, currently) are now enforced when instantiating/specializing templates and when considering partial specializations and function overloads.
      - Elaborated diagnostics give helpful insight as to why the constraints were not satisfied.
      Phabricator: D41569
      
      Re-commit, after fixing some memory bugs.
      fdf80e86
    • Fangrui Song's avatar
      [IR] Move ctor in the NDEBUG branch · 7faa8440
      Fangrui Song authored
      7faa8440
    • Fangrui Song's avatar
      b98f3ce3
    • Richard Smith's avatar
      Properly convert all declaration non-type template arguments when · b220662a
      Richard Smith authored
      forming non-type template parameter values.
      
      This reverts commit 93cc9ddd,
      which reverted commit 11d10527.
      
      We now always form `&x` when forming a pointer to a function rather than
      trying to use function-to-pointer decay. This matches the behavior of
      the old code in this case, but not the intent as described by the
      comments.
      b220662a
    • Eric Christopher's avatar
    • Jon Chesterfield's avatar
      [libomptarget][nfc] Introduce SHARED, ALIGN macros · 4af84d26
      Jon Chesterfield authored
      Summary:
      [libomptarget][nfc] Introduce SHARED, ALIGN macros
      Move remaining cuda attributes behind such macros
      
      Reviewers: ABataev, jdoerfert, grokos
      
      Reviewed By: ABataev
      
      Subscribers: openmp-commits, jvesely
      
      Tags: #openmp
      
      Differential Revision: https://reviews.llvm.org/D71076
      4af84d26
    • Adrian Prantl's avatar
      Debug Info: Apply a default location for cleanups if none is available. · 338588d7
      Adrian Prantl authored
      This unbreaks the debuginfo-tests testsuite by replacing the assertion
      with a default location. There are cleanups in helper functions that
      don't have a valid source location such as block copy helpers and it's
      not worth tracking each of them down.
      
      rdar://57630879
      338588d7
    • David Blaikie's avatar
      DebugInfo: Fix LTO+DWARFv5 loclists · decee04e
      David Blaikie authored
      The loclists_table_base was being overwritten for each CU even though
      only one loclists contribution is made so everything but the last CU
      would have a label that was never defined and fail to assemble.
      decee04e
    • Adrian Prantl's avatar
    • Adrian Prantl's avatar
      Set a source location for Objective-C accessor stubs · a1a9aa17
      Adrian Prantl authored
      even when there is no explicit synthesize statement.
      
      This fixes a regression introduced in https://reviews.llvm.org/D68108
      that could lead to missing debug locations in cleanup code in
      synthesized Objective-C++ properties.
      
      rdar://57630879
      
      Differential Revision: https://reviews.llvm.org/D71084
      a1a9aa17
    • Jon Chesterfield's avatar
      [libomptarget][nfc] Move omptarget-nvptx under common · d0b9ed5c
      Jon Chesterfield authored
      Summary:
      [libomptarget][nfc] Move omptarget-nvptx under common
      
      Almost all files depend on require omptarget-nvptx, which no longer
      contains any obviously architecture dependent code. Moving it under
      common unblocks task/loop for amdgcn, and allows moving other code.
      
      At some point there should probably be a widespread symbol renaming to
      replace the nvptx string. I'd prefer to get things working first.
      
      Building this (and task.cu, loop.cu) without a cuda library requires
      some more refactoring, e.g. wrap threadfence(), use DEVICE macro more
      consistently. Patches for that are orthogonal and will be posted shortly.
      
      Reviewers: jdoerfert, ABataev, grokos
      
      Reviewed By: ABataev
      
      Subscribers: mgorny, fedor.sergeev, jfb, openmp-commits
      
      Tags: #openmp
      
      Differential Revision: https://reviews.llvm.org/D71073
      d0b9ed5c
    • David Tenty's avatar
      [AIX] Make sure to use QualNames for external global objects · 1ea1e053
      David Tenty authored
      Summary: Previously we only handled the case where the csect hadn't been set up yet, so we'd hit an assert later on.
      
      Reviewers: jasonliu, DiggerLin, stevewan
      
      Reviewed By: jasonliu
      
      Subscribers: hubert.reinterpretcast, wuzish, nemanjai, hiraditya, kbarton, jsji, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71032
      1ea1e053
    • Aaron Ballman's avatar
      Add documentation headings for the OpenCL attributes. · f5193d87
      Aaron Ballman authored
      This fixes the documentation build.
      f5193d87
    • cchen's avatar
      [OpenMP50] Add parallel master construct · 47d6094d
      cchen authored
      Reviewers: ABataev, jdoerfert
      
      Reviewed By: ABataev
      
      Subscribers: rnk, jholewinski, guansong, arphaman, jfb, cfe-commits, sandoval, dreachem
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D70726
      47d6094d
    • Amy Huang's avatar
      Use diff -b on zlib tests so they pass on Windows · 23e63a90
      Amy Huang authored
      Reviewers: hubert.reinterpretcast
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71036
      23e63a90
    • Nathan Ridge's avatar
      [clangd] Highlighting dependent types in more contexts · de3dbc4f
      Nathan Ridge authored
      Fixes https://github.com/clangd/clangd/issues/214.
      
      Reviewers: ilya-biryukov
      
      Reviewed By: ilya-biryukov
      
      Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D70746
      de3dbc4f
    • Nathan Ridge's avatar
      [clangd] Find reference to template parameter in 'sizeof...' expression · 1a4ee4c8
      Nathan Ridge authored
      Fixes https://github.com/clangd/clangd/issues/213.
      
      Reviewers: ilya-biryukov
      
      Reviewed By: ilya-biryukov
      
      Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D70740
      1a4ee4c8
    • Florian Hahn's avatar
    • Evgenii Stepanov's avatar
      LowerDbgDeclare: look through bitcasts. · 6f89cbc4
      Evgenii Stepanov authored
      Summary:
      Emit a value debug intrinsic (with OP_deref) when an alloca address is
      passed to a function call after going through a bitcast.
      
      This generates an FP or SP-relative location for the local variable in
      the following case:
        int x;
        use((void *)&x;
      
      Reviewers: aprantl, vsk, pcc
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D70752
      6f89cbc4
    • Peter Collingbourne's avatar
      scudo: Fix one of the C wrapper tests on Android. · c8a2882a
      Peter Collingbourne authored
      The test ScudoWrappersCTest.Realloc expects realloc of memalign to work on
      Android, but this relies on dealloc_type_mismatch being set to false. Commit
      0d3d4d3b caused us to start setting it to true in the C wrapper tests,
      which broke the test. Set it to the correct value on Android.
      
      Differential Revision: https://reviews.llvm.org/D71078
      c8a2882a
    • Peter Collingbourne's avatar
      scudo: Fix the build of wrappers_c_test.cpp on Android. · 0cfe0a7b
      Peter Collingbourne authored
      The Android headers don't provide a declaration of valloc or pvalloc, so we
      need to declare them ourselves.
      
      Differential Revision: https://reviews.llvm.org/D71077
      0cfe0a7b
    • Volkan Keles's avatar
      [GlobalISel] Localizer: Allow targets not to run the pass conditionally · bfa3d260
      Volkan Keles authored
      Summary:
      Previously, it was not possible to skip running the localizer pass
      conditionally. This patch adds an input function to the pass which
      decides if the pass should run on the given MachineFunction or not.
      
      No test case as there is no upstream target needs this functionality.
      
      Reviewers: qcolombet
      
      Reviewed By: qcolombet
      
      Subscribers: rovka, hiraditya, Petar.Avramovic, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71038
      bfa3d260
    • Craig Topper's avatar
      [X86] Remove ProcIntelGLM/ProcIntelGLP/ProcIntelTRM and replace them with a... · f688570d
      Craig Topper authored
      [X86] Remove ProcIntelGLM/ProcIntelGLP/ProcIntelTRM and replace them with a single feature flag covers the two places they were used.
      
      Differential Revision: https://reviews.llvm.org/D71048
      f688570d
    • Bob Haarman's avatar
      Revert "[InstCombine] keep assumption before sinking calls" · 055779a9
      Bob Haarman authored
      Summary:
      This reverts commit c3b06d0c.
      
      Reason for revert: Caused miscompiles when inserting assume for undef.
      
      Also adds a test to prevent similar breakage in future.
      
      Fixes PR44154.
      
      Reviewers: rnk, jdoerfert, efriedma, xbolva00
      
      Reviewed By: rnk
      
      Subscribers: thakis, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D70933
      055779a9
    • Alexey Bataev's avatar
      [OPENMP50]Add support for if clause for simd part in distribute parallel for simd directive. · 52812f2a
      Alexey Bataev authored
      According to OpenMP 5.0, the if clause can be applied to simd
      subdirective in the combined directives.
      52812f2a
    • Roman Lebedev's avatar
      [InstCombine] Invert `add A, sext(B) --> sub A, zext(B)` canonicalization (to... · 796fa662
      Roman Lebedev authored
      [InstCombine] Invert `add A, sext(B) --> sub A, zext(B)` canonicalization (to `sub A, zext B -> add A, sext B`)
      
      Summary:
      D68408 proposes to greatly improve our negation sinking abilities.
      But in current canonicalization, we produce `sub A, zext(B)`,
      which we will consider non-canonical and try to sink that negation,
      undoing the existing canonicalization.
      So unless we explicitly stop producing previous canonicalization,
      we will have two conflicting folds, and will end up endlessly looping.
      
      This inverts canonicalization, and adds back the obvious fold
      that we'd miss:
      * `sub [nsw] Op0, sext/zext (bool Y) -> add [nsw] Op0, zext/sext (bool Y)`
        https://rise4fun.com/Alive/xx4
      * `sext(bool) + C -> bool ? C - 1 : C`
        https://rise4fun.com/Alive/fBl
      
      It is obvious that `@ossfuzz_9880()` / `@lshr_out_of_range()`/`@ashr_out_of_range()`
      (oss-fuzz 4871) are no longer folded as much, though those aren't really worrying.
      
      Reviewers: spatel, efriedma, t.p.northover, hfinkel
      
      Reviewed By: spatel
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71064
      796fa662
    • Fangrui Song's avatar
      [ELF][PPC64] Support long branch thunks with addends · c8f0d3e1
      Fangrui Song authored
      Fixes PPC64 part of PR40438
      
        // clang -target ppc64le -c a.cc
        // .text.unlikely may be placed in a separate output section (via -z keep-text-section-prefix)
        // The distance between bar in .text.unlikely and foo in .text may be larger than 32MiB.
        static void foo() {}
        __attribute__((section(".text.unlikely"))) static int bar() { foo(); return 0; }
        __attribute__((used)) static int dummy = bar();
      
      This patch makes such thunks with addends work for PPC64.
      
      AArch64: .text -> `__AArch64ADRPThunk_ (adrp x16, ...; add x16, x16, ...; br x16)` -> target
      PPC64: .text -> `__long_branch_ (addis 12, 2, ...; ld 12, ...(12); mtctr 12; bctr)` -> target
      
      AArch64 can leverage ADRP to jump to the target directly, but PPC64
      needs to load an address from .branch_lt . Before Power ISA v3.0, the
      PC-relative ADDPCIS was not available. .branch_lt was invented to work
      around the limitation.
      
      Symbol::ppc64BranchltIndex is replaced by
      PPC64LongBranchTargetSection::entry_index which take addends into
      consideration.
      
      The tests are rewritten: ppc64-long-branch.s tests -no-pie and
      ppc64-long-branch-pi.s tests -pie and -shared.
      
      Reviewed By: sfertile
      
      Differential Revision: https://reviews.llvm.org/D70937
      c8f0d3e1
    • Sanne Wouda's avatar
      [AArch64] Fix MUL/SUB fusing · e503fee9
      Sanne Wouda authored
      Summary:
      When MUL is the first operand to SUB, we can't use MLS because the accumulator
      should be negated.  Emit a NEG of the accumulator and an MLA instead, similar to
      what we do for FMUL / FSUB fusing.
      
      Reviewers: dmgreen, SjoerdMeijer, fhahn, Gerolf, mstorsjo, asbirlea
      
      Reviewed By: asbirlea
      
      Subscribers: kristof.beyls, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71067
      e503fee9
    • shafik's avatar
      [LLDB] Replacing use of ul suffix in GetMaxU64Bitfield since it not guarenteed to be 64 bit · fffd7029
      shafik authored
      GetMaxU64Bitfield(...) uses the ul suffix but we require a 64 bit unsigned integer and ul could be 32 bit. So this replacing it with a explicit cast and refactors the code around it to use an early exit.
      
      Differential Revision: https://reviews.llvm.org/D70992
      fffd7029
    • Puyan Lotfi's avatar
      [llvm] llvm-ifs: Support for handling empty IFS and merging weak+strong symbols. · ef7267de
      Puyan Lotfi authored
      The following changes enable llvm-ifs to handle the following merge conflicts:
      
      * Weak + Strong symbol merging for the same symbol
      * empty vs non-empty triple field
      * empty vs non-empty object file format
      
      Differential Revision: https://reviews.llvm.org/D70834
      ef7267de