1. Nov 06, 2020
    • Yevgeny Rouban's avatar
      [BranchProbabilityInfo] Remove block handles in eraseBlock() · e38c8e75
      Yevgeny Rouban authored
      BranchProbabilityInfo::eraseBlock() is a public method and
      can be called without deleting the block itself.
      This method is made remove the correspondent tracking handle
      from BranchProbabilityInfo::Handles along with
      the probabilities of the block. Handles.erase() call is moved
      to eraseBlock().
      In setEdgeProbability() we need to add the block handle only once.
      
      Reviewed By: kazu
      
      Differential Revision: https://reviews.llvm.org/D90838
      e38c8e75
    • Stella Laurenzo's avatar
      [mlir][CAPI] Add missing 'static' to inline C function. · 60e2c5b0
      Stella Laurenzo authored
      * Asked to submit separately from https://reviews.llvm.org/D90824
      60e2c5b0
    • Yevgeny Rouban's avatar
      [BranchProbabilityInfo] Get rid of MaxSuccIdx. NFC · 4931158d
      Yevgeny Rouban authored
      This refactoring allows to eliminate the MaxSuccIdx map
      proposed in the commit a7b662d0.
      The idea is to remove probabilities for a block BB for
      all its successors one by one from first, second, ...
      till N-th until they are defined in Probs. This works
      because probabilities for the block are set at once for
      all its successors from number 0 to N-1 and the rest
      are removed if there were stale probs.
      The protected method setEdgeProbability(), which set
      probabilities for individual successor, is removed.
      This makes it clear that the probabilities are set in
      bulk by the public method with the same name.
      
      Reviewed By: kazu, MaskRay
      
      Differential Revision: https://reviews.llvm.org/D90837
      4931158d
    • Mehdi Amini's avatar
      Check for nullptr before dereferencing in translateModuleToLLVMIR() · 2af37cf7
      Mehdi Amini authored
      This is defensive with respect to invocations of this API with an IR
      that isn't ready to be converted to LLVM IR.
      2af37cf7
    • Fangrui Song's avatar
      [test] Properly test -Werror-implicit-function-declaration and -Wvec-elem-size · 247c5b5d
      Fangrui Song authored
      Reviewed By: dblaikie
      
      Differential Revision: https://reviews.llvm.org/D90874
      247c5b5d
    • Valentin Clement's avatar
      [flang][openacc] Add parsing tests and semantic check for set directive · 9914a873
      Valentin Clement authored
      This patch add some parsing and clause validity tests for the set directive.
      It makes use of the possibility introduces in patch D90770 to check the restriction
      were one of the default_async, device_num and device_type clauses is required but also
      not more than once on the set directive.
      
      Reviewed By: sameeranjoshi
      
      Differential Revision: https://reviews.llvm.org/D90771
      9914a873
    • Walter Erquinigo's avatar
      [trace][intel-pt] Implement the basic decoding functionality · cfd96f05
      Walter Erquinigo authored
      Depends on D89408.
      
      This diff finally implements trace decoding!
      
      The current interface is
      
        $ trace load /path/to/trace/session/file.json
        $ thread trace dump instructions
      
        thread #1: tid = 3842849, total instructions = 22
          [ 0] 0x40052d
          [ 1] 0x40052d
          ...
          [19] 0x400521
      
        $ # simply enter, which is a repeat command
          [20] 0x40052d
          [21] 0x400529
          ...
      
      This doesn't do any disassembly, which will be done in the next diff.
      
      Changes:
      - Added an IntelPTDecoder class, that is a wrapper for libipt, which is the actual library that performs the decoding.
      - Added TraceThreadDecoder class that decodes traces and memoizes the result to avoid repeating the decoding step.
      - Added a DecodedThread class, which represents the output from decoding and that for the time being only stores the list of reconstructed instructions. Later it'll contain the function call hierarchy, which will enable reconstructing backtraces.
      - Added basic APIs for accessing the trace in Trace.h:
        - GetInstructionCount, which counts the number of instructions traced for a given thread
        - IsTraceFailed, which returns an Error if decoding a thread failed
        - ForEachInstruction, which iterates on the instructions traced for a given thread, concealing the internal storage of threads, as plug-ins can decide to generate the instructions on the fly or to store them all in a vector, like I do.
      - DumpTraceInstructions was updated to print the instructions or show an error message if decoding was impossible.
      - Tests included
      
      Differential Revision: https://reviews.llvm.org/D89283
      cfd96f05
    • Kazushi (Jam) Marukawa's avatar
      [VE][NFC] Update rem.ll regression test · b8745751
      Kazushi (Jam) Marukawa authored
      `Replace ISD::SREM handling with KnownBits::srem to reduce code
      duplication` (bf04e343) changed
      the result of rem.ll regression test.  So, updating it.
      b8745751
    • Luo, Yuanke's avatar
      [X86] check the k pair register in ipra-reg-usage.ll. · 6ca8569f
      Luo, Yuanke authored
      Reviewed By: pengfei
      
      Differential Revision: https://reviews.llvm.org/D90810
      6ca8569f
    • Stella Stamenova's avatar
      Revert "Allow searching for prebuilt implicit modules." · c67656b9
      Stella Stamenova authored
      This reverts commit 71e108cd.
      
      This change caused a build failure on Windows:
      http://lab.llvm.org:8011/#/builders/83/builds/570
      c67656b9
    • Jonas Devlieghere's avatar
      [lldb] Remove Crashlog/interactive.test · 99a99c29
      Jonas Devlieghere authored
      This test requires running under the Python we built against (which is
      easy) and setting up the PYTHONPATH (which is not worth it for this
      simple test).
      99a99c29
    • Giorgis Georgakoudis's avatar
      [CodeExtractor] Replace uses of extracted bitcasts in out-of-region lifetime markers · 700d2417
      Giorgis Georgakoudis authored
      CodeExtractor handles bitcasts in the extracted region that have
      lifetime markers users in the outer region as outputs. That
      creates unnecessary alloca/reload instructions and extra lifetime
      markers. The patch identifies those cases, and replaces uses in
      out-of-region lifetime markers with new bitcasts in the outer region.
      
      **Example**
      ```
      define void @foo() {
      entry:
        %0 = alloca i32
        br label %extract
      
      extract:
        %1 = bitcast i32* %0 to i8*
        call void @llvm.lifetime.start.p0i8(i64 4, i8* %1)
        call void @use(i32* %0)
        br label %exit
      
      exit:
        call void @use(i32* %0)
        call void @llvm.lifetime.end.p0i8(i64 4, i8* %1)
        ret void
      }
      ```
      
      **Current extraction**
      ```
      define void @foo() {
      entry:
        %.loc = alloca i8*, align 8
        %0 = alloca i32, align 4
        br label %codeRepl
      
      codeRepl:                                         ; preds = %entry
        %lt.cast = bitcast i8** %.loc to i8*
        call void @llvm.lifetime.start.p0i8(i64 -1, i8* %lt.cast)
        %lt.cast1 = bitcast i32* %0 to i8*
        call void @llvm.lifetime.start.p0i8(i64 -1, i8* %lt.cast1)
        call void @foo.extract(i32* %0, i8** %.loc)
        %.reload = load i8*, i8** %.loc, align 8
        call void @llvm.lifetime.end.p0i8(i64 -1, i8* %lt.cast)
        br label %exit
      
      exit:                                             ; preds = %codeRepl
        call void @use(i32* %0)
        call void @llvm.lifetime.end.p0i8(i64 4, i8* %.reload)
        ret void
      }
      
      define internal void @foo.extract(i32* %0, i8** %.out) {
      newFuncRoot:
        br label %extract
      
      exit.exitStub:                                    ; preds = %extract
        ret void
      
      extract:                                          ; preds = %newFuncRoot
        %1 = bitcast i32* %0 to i8*
        store i8* %1, i8** %.out, align 8
        call void @use(i32* %0)
        br label %exit.exitStub
      }
      ```
      
      **Extraction with patch**
      ```
      define void @foo() {
      entry:
        %0 = alloca i32, align 4
        br label %codeRepl
      
      codeRepl:                                         ; preds = %entry
        %lt.cast1 = bitcast i32* %0 to i8*
        call void @llvm.lifetime.start.p0i8(i64 -1, i8* %lt.cast1)
        call void @foo.extract(i32* %0)
        br label %exit
      
      exit:                                             ; preds = %codeRepl
        call void @use(i32* %0)
        %lt.cast = bitcast i32* %0 to i8*
        call void @llvm.lifetime.end.p0i8(i64 4, i8* %lt.cast)
        ret void
      }
      
      define internal void @foo.extract(i32* %0) {
      newFuncRoot:
        br label %extract
      
      exit.exitStub:                                    ; preds = %extract
        ret void
      
      extract:                                          ; preds = %newFuncRoot
        %1 = bitcast i32* %0 to i8*
        call void @use(i32* %0)
        br label %exit.exitStub
      }
      ```
      
      Reviewed By: vsk
      
      Differential Revision: https://reviews.llvm.org/D90689
      700d2417
    • Vedant Kumar's avatar
      [TargetList] Delete the destructor · 65d15fef
      Vedant Kumar authored
      AFAICT, ~TargetList simply implements the default destructor, plus some
      locking.
      
      The history is murky, so I'm not sure why we do this locking. Perhaps,
      at some point, it was possible to delete the same TargetList instance
      from two different threads, setting up a race. If that were true, then
      the locking would protect against the race.
      
      Since TargetList is uniquely owned by Debugger (m_target_list), no such
      race is possible today.
      
      Testing: check-lldb
      
      Differential Revision: https://reviews.llvm.org/D90895
      65d15fef
    • Stanislav Mekhanoshin's avatar
      4fcdfc43
    • Siva Chandra Reddy's avatar
      [libc] Add implementations of ilogb[f|l]. · 930cf1cb
      Siva Chandra Reddy authored
      Depends on D90805.
      
      Reviewed By: lntue
      
      Differential Revision: https://reviews.llvm.org/D90806
      930cf1cb
    • Sean Silva's avatar
      [STLExtras] Add append_range helper. · e9e2e310
      Sean Silva authored
      This is convenient in a lot of cases, such as when the thing you want
      to append is `someReallyLongFunctionName()` that you'd rather not
      write twice or assign to a variable for the paired begin/end calls.
      
      Differential Revision: https://reviews.llvm.org/D90894
      e9e2e310
    • Craig Topper's avatar
      [RISCV] Only enable GPR<->FPR32 bitconvert isel patterns on RV32. NFCI · 741b04b0
      Craig Topper authored
      Bitconvert requires the bitwidth to match on both sides. On RV64
      the GPR size is i64 so bitconvert between f32 isn't possible. The
      node should never be generated so the pattern won't ever match, but
      moving the patterns under IsRV32 makes it more obviously impossible.
      It also moves it to a similar location to the patterns for the
      custom nodes we use for RV64.
      741b04b0
    • Siva Chandra Reddy's avatar
      [libc][NFC] Make test macros callable from helper methods of test classes. · 0e3532da
      Siva Chandra Reddy authored
      This is acheived by making the RunContext a state variable of the test
      classes.
      
      Reviewed By: lntue
      
      Differential Revision: https://reviews.llvm.org/D90805
      0e3532da
    • Konstantin Pyzhov's avatar
      [AMDGPU] Corrected declaration of VOPC instructions with SDWA addressing mode. · 41e74e40
      Konstantin Pyzhov authored
      Removed "implicit def VCC" from declarations of AMDGPU VOPC instructions since they do not implicitly write to VCC in SDWA mode.
      
      Differential Revision: https://reviews.llvm.org/D89168
      41e74e40
    • Louis Dionne's avatar
    • Michael Liao's avatar
      [amdgpu] Add `llvm.amdgcn.endpgm` support. · 23c6d150
      Michael Liao authored
      - `llvm.amdgcn.endpgm` is added to enable "abort" support.
      
      Differential Revision: https://reviews.llvm.org/D90809
      23c6d150
    • Vedant Kumar's avatar
      [TargetList] Simplify dummy target creation · 16e5a347
      Vedant Kumar authored
      Factor out dummy target creation from CreateTargetInternal.
      
      This makes it impossible for dummy target creation to accidentally fail
      due to too-strict checking in one of the CreateTargetInternal overloads.
      
      Testing: check-lldb
      
      rdar://70630655
      
      Differential Revision: https://reviews.llvm.org/D90872
      16e5a347
    • Louis Dionne's avatar
      [libc++] Allow customizing a few paths when running build bots · 3790e17f
      Louis Dionne authored
      This allows reusing run-buildbot for downstream testing as well.
      3790e17f
    • Louis Dionne's avatar
      [libc++] Add a Buildkite job that tests back-deployment on Apple · bb43a0cd
      Louis Dionne authored
      The current way we test this is pretty cheap, i.e. we download previously
      released macOS dylibs and run against that. Ideally, we would require a
      full host running the appropriate version of macOS, and we'd execute the
      tests using SSH on that host. But since we don't have such hosts available
      easily for now, this is better than nothing.
      
      At the same time, also fix some tests that were failing when back
      deploying.
      
      Differential Revision: https://reviews.llvm.org/D90869
      bb43a0cd
    • Yuriy Chernyshov's avatar
      Do not construct std::string from nullptr · 99e64623
      Yuriy Chernyshov authored
      While I am trying to forbid such usages systematically in https://reviews.llvm.org/D79427 / P2166R0 to C++ standard, this PR fixes this (definitelly incorrect) usage in llvm.
      
      This code is unreachable, so it could not cause any harm
      
      Reviewed By: nikic, dblaikie
      
      Differential Revision: https://reviews.llvm.org/D87697
      99e64623
    • Craig Topper's avatar
      [RISCV] Add isel patterns for fnmadd/fnmsub with an fneg on the second operand... · defe1186
      Craig Topper authored
      [RISCV] Add isel patterns for fnmadd/fnmsub with an fneg on the second operand instead of the first.
      
      The multiply part of FMA is commutable, but TargetSelectionDAG.td
      doesn't have it marked as commutable so tablegen won't automatically
      create the additional patterns.
      
      So manually add commuted patterns.
      defe1186
    • Craig Topper's avatar
      [RISCV] Add test cases to show missed opportunities to use fnmadd/fnmsub if... · 4a4f4f78
      Craig Topper authored
      [RISCV] Add test cases to show missed opportunities to use fnmadd/fnmsub if the second operand to the fma is negated rather than the first. NFC
      
      We need to add more isel patterns to handle this.
      4a4f4f78
    • Pedro Tammela's avatar
      [LLDB-lua] modify Lua's 'print' to respect 'io.stdout' · ca175710
      Pedro Tammela authored
      This patch changes the implementation of Lua's `print()` function to
      respect `io.stdout`.
      
      The original implementation uses `lua_writestring()` internally, which is
      hardcoded to `stdout`.
      
      Reviewed By: JDevlieghere
      
      Differential Revision: https://reviews.llvm.org/D90787
      ca175710
    • Saleem Abdulrasool's avatar
      APINotes: repair the Windows builders · e5515787
      Saleem Abdulrasool authored
      Disable the test on Windows, which should've been obvious as being
      needed.  The differences in diff implementations and line-endings make
      this test difficult to execute on Windows.
      e5515787
    • Valentin Clement's avatar
      [openacc][openmp] Allow duplicate between required and allowed once/exclusive · a8a10acb
      Valentin Clement authored
      Validity check introduce in D90241 are a bit too restrict and this patch propose to losen
      them a bit. The duplicate clauses is now check only between the three allowed lists and between the
      requiredClauses and allowedClauses lists. This allows to enable some check where a clause can be
      required but also appear only once on the directive. We found these kind of restriction useful
      on the set directive in OpenACC for example.
      
      Reviewed By: kiranchandramohan
      
      Differential Revision: https://reviews.llvm.org/D90770
      a8a10acb
    • Paul C. Anagnostopoulos's avatar
    • Mehdi Amini's avatar
      Fix MLIR Python bindings build (NFC) · bd701ab4
      Mehdi Amini authored
      The CMake macro refactoring had a hardcoded value left instead of using
      the function argument.
      Didn't catch it locally before because it required a clean build to
      trigger.
      bd701ab4
    • Alexandre Rames's avatar
      Allow searching for prebuilt implicit modules. · 71e108cd
      Alexandre Rames authored
      The behavior is controlled by the `-fprebuilt-implicit-modules` option, and
      allows searching for implicit modules in the prebuilt module cache paths.
      
      The current command-line options for prebuilt modules do not allow to easily
      maintain and use multiple versions of modules. Both the producer and users of
      prebuilt modules are required to know the relationships between compilation
      options and module file paths. Using a particular version of a prebuilt module
      requires passing a particular option on the command line (e.g.
      `-fmodule-file=[<name>=]<file>` or `-fprebuilt-module-path=<directory>`).
      
      However the compiler already knows how to distinguish and automatically locate
      implicit modules. Hence this proposal to introduce the
      `-fprebuilt-implicit-modules` option. When set, it enables searching for
      implicit modules in the prebuilt module paths (specified via
      `-fprebuilt-module-path`). To not modify existing behavior, this search takes
      place after the standard search for prebuilt modules. If not
      
      Here is a workflow illustrating how both the producer and consumer of prebuilt
      modules would need to know what versions of prebuilt modules are available and
      where they are located.
      
        clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo -fmodules-cache-path=prebuilt_modules_v1 <config 1 options>
        clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo -fmodules-cache-path=prebuilt_modules_v2 <config 2 options>
        clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo -fmodules-cache-path=prebuilt_modules_v3 <config 3 options>
      
        clang -cc1 -x c use.c -fmodules fmodule-map-file=modulemap -fprebuilt-module-path=prebuilt_modules_v1 <config 1 options>
        clang -cc1 -x c use.c -fmodules fmodule-map-file=modulemap <non-prebuilt config options>
      
      With prebuilt implicit modules, the producer can generate prebuilt modules as
      usual, all in the same output directory. The same mechanisms as for implicit
      modules take care of incorporating hashes in the path to distinguish between
      module versions.
      
      Note that we do not specify the output module filename, so `-o` implicit modules are generated in the cache path `prebuilt_modules`.
      
        clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo -fmodules-cache-path=prebuilt_modules <config 1 options>
        clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo -fmodules-cache-path=prebuilt_modules <config 2 options>
        clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo -fmodules-cache-path=prebuilt_modules <config 3 options>
      
      The user can now simply enable prebuilt implicit modules and point to the
      prebuilt modules cache. No need to "parse" command-line options to decide
      what prebuilt modules (paths) to use.
      
        clang -cc1 -x c use.c -fmodules fmodule-map-file=modulemap -fprebuilt-module-path=prebuilt_modules -fprebuilt-implicit-modules <config 1 options>
        clang -cc1 -x c use.c -fmodules fmodule-map-file=modulemap -fprebuilt-module-path=prebuilt_modules -fprebuilt-implicit-modules <non-prebuilt config options>
      
      This is for example particularly useful in a use-case where compilation is
      expensive, and the configurations expected to be used are predictable, but not
      controlled by the producer of prebuilt modules. Modules for the set of
      predictable configurations can be prebuilt, and using them does not require
      "parsing" the configuration (command-line options).
      
      Reviewed By: Bigcheese
      
      Differential Revision: https://reviews.llvm.org/D68997
      71e108cd
    • Kazushi (Jam) Marukawa's avatar
      [VE] Add isReMaterializable and isAsCheapAsAMove flags · f0e585d5
      Kazushi (Jam) Marukawa authored
      Add isReMaterializable and isCheapAsAMove flags to integer instructions
      which cost cheap.
      
      Reviewed By: simoll
      
      Differential Revision: https://reviews.llvm.org/D90833
      f0e585d5
    • Reid Kleckner's avatar
      Fix bugs in EOL marking in command line tokenizers · f5524745
      Reid Kleckner authored
      Add unit tests for this behavior, since the integration test for
      clang-cl did not catch these bugs.
      
      Fixes PR47604
      
      Differential Revision: https://reviews.llvm.org/D90866
      f5524745
    • Jan Ole Hüser's avatar
      [CodeGen] Fix Bug 47499: __unaligned extension inconsistent behaviour with C and C++ · d2e7dca5
      Jan Ole Hüser authored
      For the language C++ the keyword __unaligned (a Microsoft extension) had no effect on pointers.
      
      The reason, why there was a difference between C and C++ for the keyword __unaligned:
      For C, the Method getAsCXXREcordDecl() returns nullptr. That guarantees that hasUnaligned() is called.
      If the language is C++, it is not guaranteed, that hasUnaligend() is called and evaluated.
      
      Here are some links:
      
      The Bug: https://bugs.llvm.org/show_bug.cgi?id=47499
      Thread on the cfe-dev mailing list: http://lists.llvm.org/pipermail/cfe-dev/2020-September/066783.html
      Diff, that introduced the check hasUnaligned() in getNaturalTypeAlignment(): https://reviews.llvm.org/D30166
      
      Reviewed By: rnk
      
      Differential Revision: https://reviews.llvm.org/D90630
      d2e7dca5
    • Albion Fung's avatar
      [PowerPC] Correct cpsgn's behaviour on PowerPC to match that of the ABI · 1af037f6
      Albion Fung authored
      This patch fixes the reversed behaviour exhibited by cpsgn on PPC. It now matches the ABI.
      
      Differential Revision: https://reviews.llvm.org/D84962
      1af037f6
    • Louis Dionne's avatar
      [libc++] Add a CI job to build the documentation · f7e4f041
      Louis Dionne authored
      At the same time, fix an issue that broke the documentation since 2eadbc86.
      f7e4f041
    • Louis Dionne's avatar
      [libc++] Update the CI Dockerfile · 738d981e
      Louis Dionne authored
      Remove Phabricator, which isn't needed anymore since we don't report
      the job results ourselves. Also, install python3-sphinx instead of
      sphinx-doc, since the latter doesn't provide the sphinx-build binary.
      738d981e
    • Mehdi Amini's avatar
      Add a custom MLIRBindingsPythonExtension cmake target to group all Python bindings (NFC) · 72dcd902
      Mehdi Amini authored
      This target will depend on each individual extension and represent "all"
      Python bindings in the repo. User projects can get a finer grain control by
      depending directly on some individual targets as needed.
      72dcd902