1. Apr 08, 2020
  2. Apr 07, 2020
    • Nikita Popov's avatar
      [RDA] Avoid full reprocessing of blocks in loops (NFCI) · 259649a5
      Nikita Popov authored
      RDA sometimes needs to visit blocks twice, to take into account
      reaching defs coming in along loop back edges. Currently it handles
      repeated visitation the same way as usual, which means that it will
      scan through all instructions and their reg unit defs again. Not
      only is this very inefficient, it also means that all reaching defs
      in loops are going to be inserted twice.
      
      We can do much better than this. The only thing we need to handle
      is a new reaching def from a predecessor, which either needs to be
      prepended to the reaching definitions (if there was no reaching def
      from a predecessor), or needs to replace an existing predecessor
      reaching def, if it is more recent. Since D77508 we only store the
      most recent predecessor reaching def, so that's the only one that
      may need updating.
      
      This also has the nice side-effect that reaching definitions are
      now automatically sorted and unique, so drop the llvm::sort() call
      in favor of an assertion.
      
      Differential Revision: https://reviews.llvm.org/D77511
      259649a5
    • Nikita Popov's avatar
      [RDA] Don't pass down TraversedMBB (NFC) · 76e987b3
      Nikita Popov authored
      Only pass the MachineBasicBlock itself down to helper methods,
      they don't need to know about traversal. Move the debug print
      into the main method.
      76e987b3
    • Nikita Popov's avatar
      [RDA] Avoid inserting duplicate reaching defs (NFCI) · 361c29d7
      Nikita Popov authored
      An instruction may define the same reg unit multiple times,
      avoid inserting the same reaching def multiple times in that case.
      
      Also print the reg unit, rather than the super-register, in the
      debug code.
      361c29d7
    • David Tenty's avatar
      [NFC][PowerPC] Cleanup 64-bit and Darwin CalleeSavedRegs · b9245f14
      David Tenty authored
      Summary:
      - Remove the no longer used Darwin CalleeSavedRegs
      - Combine the SVR464 callee saved regs and AIX64 since the two are (and should be) identical into PPC64
      - Update tests for 64-bit CSR change
      
      Reviewers: sfertile, ZarkoCA, cebowleratibm, jasonliu, #powerpc
      
      Reviewed By: sfertile
      
      Subscribers: wuzish, nemanjai, hiraditya, kbarton, shchenz, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77235
      b9245f14
    • diggerlin's avatar
      [NFC][XCOFF] refactor readobj/XCOFFDumper.cpp · 3aa08494
      diggerlin authored
      SUMMARY:
      
      refactor readobj/XCOFFDumper.cpp with helper function getAlignmentLog2() , getSymbolType(), isLabel().
      
      Reviewers: Hubert Tong, James Henderson
      Subscribers: rupprecht, seiyai,hiradityu
      
      Differential Revision: https://reviews.llvm.org/D77562
      3aa08494
    • Dmitry Vyukov's avatar
      tsan: fix Go/ppc build · 2db63723
      Dmitry Vyukov authored
      PPC now requires ReExec due to ASLR.
      Pull in more functions for Go build.
      
      Suggested-by: Keith Randall (khr)
      2db63723
    • Raphael Isemann's avatar
    • Sriraman Tallam's avatar
      LLD Support for Basic Block Sections · 94317878
      Sriraman Tallam authored
      This is part of the Propeller framework to do post link code layout
      optimizations. Please see the RFC here:
      https://groups.google.com/forum/#!msg/llvm-dev/ef3mKzAdJ7U/1shV64BYBAAJ and the
      detailed RFC doc here:
      https://github.com/google/llvm-propeller/blob/plo-dev/Propeller_RFC.pdf
      
      This patch adds lld support for basic block sections and performs relaxations
      after the basic blocks have been reordered.
      
      After the linker has reordered the basic block sections according to the
      desired sequence, it runs a relaxation pass to optimize jump instructions.
      Currently, the compiler emits the long form of all jump instructions. AMD64 ISA
      supports variants of jump instructions with one byte offset or a four byte
      offset. The compiler generates jump instructions with R_X86_64 32-bit PC
      relative relocations. We would like to use a new relocation type for these jump
      instructions as it makes it easy and accurate while relaxing these instructions.
      
      The relaxation pass does two things:
      
      First, it deletes all explicit fall-through direct jump instructions between
      adjacent basic blocks. This is done by discarding the tail of the basic block
      section.
      
      Second, If there are consecutive jump instructions, it checks if the first
      conditional jump can be inverted to convert the second into a fall through and
      delete the second.
      
      The jump instructions are relaxed by using jump instruction mods, something
      like relocations. These are used to modify the opcode of the jump instruction.
      Jump instruction mods contain three values, instruction offset, jump type and
      size. While writing this jump instruction out to the final binary, the linker
      uses the jump instruction mod to determine the opcode and the size of the
      modified jump instruction. These mods are required because the input object
      files are memory-mapped without write permissions and directly modifying the
      object files requires copying these sections. Copying a large number of basic
      block sections significantly bloats memory.
      
      Differential Revision: https://reviews.llvm.org/D68065
      94317878
    • Michael Liao's avatar
      [hip] Remove `hip_pinned_shadow`. · c97be2c3
      Michael Liao authored
      Summary:
      - Use `device_builtin_surface` and `device_builtin_texture` for
        surface/texture reference support. So far, both the host and device
        use the same reference type, which could be revised later when
        interface/implementation is stablized.
      
      Reviewers: yaxunl
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D77583
      c97be2c3
    • Simon Pilgrim's avatar
      [X86][SSE] combineX86ShufflesConstants - early out for zeroable vectors (PR45443) · e3b60597
      Simon Pilgrim authored
      Shuffle combining can insert zero byte sized elements into the shuffle mask, which combineX86ShufflesConstants will attempt to fold without taking into account whether the byte-sized type is legal (e.g. AVX512F only targets).
      
      If we have a full-zeroable vector then we should just return a zero version of the root type, otherwise if the type isn't valid we should bail.
      
      Fixes PR45443
      e3b60597
    • Artem Dergachev's avatar
      6b3353e8
    • Louis Dionne's avatar
      [libc++abi] Enable the new libc++ testing format by default · 2eb8864b
      Louis Dionne authored
      The new format should be equivalent to the old format, and it is now the
      default format when running the libc++ tests. This commit changes the
      libc++abi tests to use the new format by default too. If unexpected failures
      are discovered, it should be fine to revert this commit until they are
      addressed.
      
      Also note that it is still possible to use the old format by passing
      `--param=use_old_format=True` when running Lit for the time being.
      2eb8864b
    • Louis Dionne's avatar
      [libc++] Support .sh.s tests in the new format · f75ebe1a
      Louis Dionne authored
      libc++abi has two of these tests.
      f75ebe1a
    • Marcel Hlopko's avatar
      [Syntax] Add mapping from spelled to expanded tokens for TokenBuffer · 1bf055c9
      Marcel Hlopko authored
      Summary:
      Same restrictions apply as in the other direction: macro arguments are
      not supported yet, only full macro expansions can be mapped.
      
      Taking over from https://reviews.llvm.org/D72581.
      
      Reviewers: gribozavr2, sammccall
      
      Reviewed By: gribozavr2
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D77209
      1bf055c9
    • Sam McCall's avatar
      [Syntax] Merge overlapping top-level macros in TokenBuffer · d66afd6d
      Sam McCall authored
      Summary:
      Our previous definition of "top-level" was too informal, and didn't
      allow for overlapping macros that each directly produce expanded tokens.
      See D77507 for previous discussion.
      
      Fixes http://bugs.llvm.org/show_bug.cgi?id=45428
      
      Reviewers: kadircet, vabridgers
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D77615
      d66afd6d
    • Florian Hahn's avatar
      [Clang] Add llvm.loop.unroll.disable to loops with -fno-unroll-loops. · 338be9c5
      Florian Hahn authored
      Currently Clang does not respect -fno-unroll-loops during LTO. During
      D76916 it was suggested to respect -fno-unroll-loops on a TU basis.
      
      This patch uses the existing llvm.loop.unroll.disable metadata to
      disable loop unrolling explicitly for each loop in the TU if
      unrolling is disabled. This should ensure that loops from TUs compiled
      with -fno-unroll-loops are skipped by the unroller during LTO.
      
      This also means that if a loop from a TU with -fno-unroll-loops
      gets inlined into a TU without this option, the loop won't be
      unrolled.
      
      Due to the fact that some transforms might drop loop metadata, there
      potentially are cases in which we still unroll loops from TUs with
      -fno-unroll-loops. I think we should fix those issues rather than
      introducing a function attribute to disable loop unrolling during LTO.
      Improving the metadata handling will benefit other use cases, like
      various loop pragmas, too. And it is an improvement to clang completely
      ignoring -fno-unroll-loops during LTO.
      
      If that direction looks good, we can use a similar approach to also
      respect -fno-vectorize during LTO, at least for LoopVectorize.
      
      In the future, this might also allow us to remove the UnrollLoops option
      LLVM's PassManagerBuilder.
      
      Reviewers: Meinersbur, hfinkel, dexonsmith, tejohnson
      
      Reviewed By: Meinersbur, tejohnson
      
      Differential Revision: https://reviews.llvm.org/D77058
      338be9c5
    • Sam McCall's avatar
      [Syntax] Simplify TokenCollector::Builder, use captured expansion bounds. NFC · ec0b9908
      Sam McCall authored
      Summary:
      The motivation here is fixing https://bugs.llvm.org/show_bug.cgi?id=45428, see
      D77507. The fundamental problem is that a "top-level" expansion wasn't precisely
      defined. Repairing this concept means that TokenBuffer's "top-level expansion"
      may not correspond to a single macro expansion. Example:
      
      ```
      M(2); // expands to 1+2
      ```
      
      The expansions overlap, but neither expansion alone yields all the tokens.
      We need a TokenBuffer::Mapping that corresponds to their union.
      
      This is fairly easy to fix in CollectPPExpansions, but the current design of
      TokenCollector::Builder needs a fix too as it relies on the macro's expansion
      range rather than the captured expansion bounds. This fix is hard to make due
      to the way code is reused within Builder. And honestly, I found that code pretty
      hard to reason about too.
      
      The new approach doesn't use the expansion range, but only the expansion
      location: it assumes an expansion is the contiguous set of expanded tokens with
      the same expansion location, which seems like a reasonable formalization of
      the "top-level" notion.
      
      And hopefully the control flow is easier to follow too, it's considerably
      shorter even with more documentation.
      
      Reviewers: kadircet
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D77614
      ec0b9908
    • Louis Dionne's avatar
      [libc++] Make sure the source file appears before link libraries when compiling tests · 9949cfbd
      Louis Dionne authored
      Otherwise, files don't link when using a GNU linker, which is more
      sensitive on the order of the source file relative to the various
      linked libraries. See http://c-faq.com/lib/libsearch.html for an
      explanation of the problem.
      9949cfbd
    • Denys Petrov's avatar
      [analyzer] Try to lift 'REQUIRES: shell' for scan-build tests. · cfd388d3
      Denys Petrov authored
      This is the second part of Denys's patch, committed separately
      due to being more risky.
      
      Differential Revision: https://reviews.llvm.org/D76768
      cfd388d3
    • Haojian Wu's avatar
      [AST] Fix a crash on invalid constexpr Ctorinitializer when building RecoveryExpr. · 041080c2
      Haojian Wu authored
      Summary:
      crash stack:
      
      ```
      
      lang:  workspace/llvm-project/clang/lib/AST/ExprConstant.cpp:13704: bool EvaluateInPlace(clang::APValue &, (anonymous namespace)::EvalInfo &, const (anonymous namespace)::LValue &, const clang::Expr *, bool): Assertion `!E->isValueDependent()' failed.
       #8  EvaluateInPlace(clang::APValue&, (anonymous namespace)::EvalInfo&, (anonymous namespace)::LValue const&, clang::Expr const*, bool)  workspace/llvm-project/clang/lib/AST/ExprConstant.cpp:0:0
       #9  HandleConstructorCall(clang::Expr const*, (anonymous namespace)::LValue const&, clang::APValue*, clang::CXXConstructorDecl const*, (anonymous namespace)::EvalInfo&, clang::APValue&)  workspace/llvm-project/clang/lib/AST/ExprConstant.cpp:5779:57
      #10  HandleConstructorCall(clang::Expr const*, (anonymous namespace)::LValue const&, llvm::ArrayRef<clang::Expr const*>, clang::CXXConstructorDecl const*, (anonymous namespace)::EvalInfo&, clang::APValue&)  workspace/llvm-project/clang/lib/AST/ExprConstant.cpp:5819:10
      #11  clang::Expr::isPotentialConstantExpr(clang::FunctionDecl const*, llvm::SmallVectorImpl<std::pair<clang::SourceLocation, clang::PartialDiagnostic> >&) workspace/llvm-project/clang/lib/AST/ExprConstant.cpp:14746:5
      #12  CheckConstexprFunctionBody(clang::Sema&, clang::FunctionDecl const*, clang::Stmt*, clang::Sema::CheckConstexprKind)  workspace/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:2306:7
      #13  clang::Sema::CheckConstexprFunctionDefinition(clang::FunctionDecl const*, clang::Sema::CheckConstexprKind)  workspace/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:1766:0
      #14  clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool)  workspace/llvm-project/clang/lib/Sema/SemaDecl.cpp:14357:9
      #15  clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&)  workspace/llvm-project/clang/lib/Parse/ParseStmt.cpp:2213:18
      ```
      
      Reviewers: sammccall
      
      Reviewed By: sammccall
      
      Subscribers: rsmith, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D77041
      041080c2
    • Nico Weber's avatar
      Stop passing site cfg files via --param to llvm-lit. · 448b777b
      Nico Weber authored
      This has been unnecessary since https://reviews.llvm.org/D37756.
      
      https://reviews.llvm.org/D37838 removed it for llvm.
      
      This removes it from clang, lld, clang-tools-extra (and the GN build).
      
      No intended behavior change.
      
      Differential Revision: https://reviews.llvm.org/D77585
      448b777b
    • Muhammad Omair Javaid's avatar
      Revert "[lldb-server] jThreadsInfo returns stack memory" · e609fe68
      Muhammad Omair Javaid authored
      This reverts commit a53bf9b7.
      e609fe68
    • Muhammad Omair Javaid's avatar
      2a436a07
    • Kadir Cetinkaya's avatar
      [clangd] Fix printing for Inclusion · 59c28103
      Kadir Cetinkaya authored
      59c28103
    • Kadir Cetinkaya's avatar
      [clangd] Get rid of ASTWorker::getCurrentFileInputs · 4ac7b805
      Kadir Cetinkaya authored
      Summary:
      FileInputs are only written by ASTWorker thread, therefore it is safe
      to read them without the lock inside that thread. It can still be read by other
      threads through ASTWorker::getCurrentCompileCommand though.
      
      This patch also gets rid of the smart pointer wrapping FileInputs as there is
      never mutliple owners.
      
      Reviewers: sammccall
      
      Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D77309
      4ac7b805
    • Georgii Rymar's avatar
      [llvm-readobj] - Introduce warnings for cases when unable to read strings from string tables. · 7fc599ce
      Georgii Rymar authored
      Currently we have no dedicated warnings, but we return error message instead of a result.
      It is generally not consistent with another warnings we have.
      
      This change was suggested and discussed here:
      https://reviews.llvm.org/D77216#1954873
      
      This change refines error messages we report and also I had to update the API
      to implement it.
      
      Differential revision: https://reviews.llvm.org/D77399
      7fc599ce
    • Sanjay Patel's avatar
      [InstCombine] add icmp+cast tests for ppc_fp128; NFC · e268ec8e
      Sanjay Patel authored
      See post-commit comments for rG0f56bbc1.
      e268ec8e
    • cchen's avatar
      Add map-type check for target and target data directive, by Chi Chun · a010ef8b
      cchen authored
      Chen
      
      Reviewers: ABataev, jdoerfert
      
      Reviewed By: ABataev
      
      Subscribers: cfe-commits, dreachem, sandoval
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D77581
      a010ef8b
    • Nathan James's avatar
      Fixed licenses in dynamic ast matchers · 3d1424bc
      Nathan James authored
      3d1424bc
    • Nathan James's avatar
      [clangd] DefineOutline: removes static token from static CXXMethodDecl · 353a9883
      Nathan James authored
      Summary: Removes the `static` token when defining a function out of line if the function is a `CXXMethodDecl`
      
      Reviewers: sammccall, kadircet, hokein
      
      Reviewed By: kadircet
      
      Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
      
      Tags: #clang, #clang-tools-extra
      
      Differential Revision: https://reviews.llvm.org/D77534
      353a9883
    • Keith Walker's avatar
      [ARM] unwinding .pad instructions missing in execute-only prologue · 01dc1077
      Keith Walker authored
      If the stack pointer is altered for local variables and we are generating
      Thumb2 execute-only code the .pad directive is missing.
      
      Usually the size of the adjustment is stored in a PC-relative location
      and loaded into a register which is then added to the stack pointer.
      However when we are generating execute-only code code the size of the
      adjustment is instead generated using the MOVW/MOVT instruction pair.
      
      As a by product of handling the execute-only case this also fixes an
      existing issue that in the none execute-only case the .pad directive was
      generated against the load of the constant to a register instruction,
      instead of the instruction which adds the register to the stack pointer.
      
      Differential Revision: https://reviews.llvm.org/D76849
      01dc1077
    • Pierre Gousseau's avatar
      [X86] Fix implicit sign conversion warnings in X86 headers. · 08fab9eb
      Pierre Gousseau authored
      Warnings in emmintrin.h and xmmintrin.h are reported by
      -fsanitize=implicit-integer-sign-change.
      
      Reviewed By: RKSimon, craig.topper
      
      Differential Revision: https://reviews.llvm.org/D77393
      08fab9eb
    • Uday Bondhugula's avatar
      [MLIR] Introduce std.alloca op · 7023f4b4
      Uday Bondhugula authored
      Introduce the alloca op for stack memory allocation. When converting to the
      LLVM dialect, this is lowered to an llvm.alloca. Refactor the std to
      llvm conversion for alloc op to reuse with alloca. Drop useAlloca option
      with alloc op lowering.
      
      Differential Revision: https://reviews.llvm.org/D76602
      7023f4b4
    • Florian Hahn's avatar
      [SCCP] Use ranges for predicate info conditions. · 6aabb109
      Florian Hahn authored
      This patch updates the code that deals with conditions from predicate
      info to make use of constant ranges.
      
      For ssa_copy instructions inserted by PredicateInfo, we have 2 ranges:
      1. The range of the original value.
      2. The range imposed by the linked condition.
      
      1. is known, 2. can be determined using makeAllowedICmpRegion. The
      intersection of those ranges is the range for the copy.
      
      With this patch, we get a nice increase in the number of instructions
      eliminated by both SCCP and IPSCCP for some benchmarks:
      
      For MultiSource, SPEC2000 & SPEC2006:
      
      Tests: 237
      Same hash: 170 (filtered out)
      Remaining: 67
      Metric: sccp.NumInstRemoved
      Program                                        base    patch   diff
       test-suite...Source/Benchmarks/sim/sim.test    10.00   71.00  610.0%
       test-suite...CFP2000/177.mesa/177.mesa.test   361.00  1626.00 350.4%
       test-suite...encode/alacconvert-encode.test   141.00  602.00  327.0%
       test-suite...decode/alacconvert-decode.test   141.00  602.00  327.0%
       test-suite...CI_Purple/SMG2000/smg2000.test   1639.00 4093.00 149.7%
       test-suite...peg2/mpeg2dec/mpeg2decode.test    75.00  163.00  117.3%
       test-suite...T2006/401.bzip2/401.bzip2.test   358.00  513.00  43.3%
       test-suite...rks/FreeBench/pifft/pifft.test    11.00   15.00  36.4%
       test-suite...langs-C/unix-tbl/unix-tbl.test     4.00    5.00  25.0%
       test-suite...lications/sqlite3/sqlite3.test   541.00  667.00  23.3%
       test-suite.../CINT2000/254.gap/254.gap.test   243.00  299.00  23.0%
       test-suite...ks/Prolangs-C/agrep/agrep.test    25.00   29.00  16.0%
       test-suite...marks/7zip/7zip-benchmark.test   1135.00 1304.00 14.9%
       test-suite...lications/ClamAV/clamscan.test   1105.00 1268.00 14.8%
       test-suite...urce/Applications/lua/lua.test   398.00  436.00   9.5%
      
      Metric: sccp.IPNumInstRemoved
      Program                                        base   patch   diff
       test-suite...C/CFP2000/179.art/179.art.test     1.00   3.00  200.0%
       test-suite...006/447.dealII/447.dealII.test   429.00 1056.00 146.2%
       test-suite...nch/fourinarow/fourinarow.test     3.00   7.00  133.3%
       test-suite...CI_Purple/SMG2000/smg2000.test   818.00 1748.00 113.7%
       test-suite...ks/McCat/04-bisect/bisect.test     3.00   5.00  66.7%
       test-suite...CFP2000/177.mesa/177.mesa.test   165.00 255.00  54.5%
       test-suite...ediabench/gsm/toast/toast.test    18.00  27.00  50.0%
       test-suite...telecomm-gsm/telecomm-gsm.test    18.00  27.00  50.0%
       test-suite...ks/Prolangs-C/agrep/agrep.test    24.00  35.00  45.8%
       test-suite...TimberWolfMC/timberwolfmc.test    43.00  62.00  44.2%
       test-suite...encode/alacconvert-encode.test    46.00  66.00  43.5%
       test-suite...decode/alacconvert-decode.test    46.00  66.00  43.5%
       test-suite...langs-C/unix-tbl/unix-tbl.test    12.00  17.00  41.7%
       test-suite...peg2/mpeg2dec/mpeg2decode.test    31.00  41.00  32.3%
       test-suite.../CINT2000/254.gap/254.gap.test   117.00 154.00  31.6%
      
      Reviewers: efriedma, davide
      
      Reviewed By: efriedma
      
      Differential Revision: https://reviews.llvm.org/D76611
      6aabb109
    • Djordje Todorovic's avatar
      [docs] Add the release notes about Debug Entry Values · 3a4d9f83
      Djordje Todorovic authored
      Note that x86, arm and aarch64 targets support the Debug Entry Values
      feature by default.
      
      Differential Revision: https://reviews.llvm.org/D77494
      3a4d9f83
    • Serguei Katkov's avatar
      [DAG] Consolidate require spill slot logic in lambda. NFC. · b7e3759e
      Serguei Katkov authored
      Move the logic whether lowering of deopt value requires a spill slot in
      a separate lambda.
      
      Reviewers: reames, dantrushin
      Reviewed By: dantrushin
      Subscribers: hiraditya, llvm-commits
      Differential Revision: https://reviews.llvm.org/D77629
      b7e3759e