1. Feb 05, 2021
    • Andrzej Warzynski's avatar
      [flang][driver] Fix reading from stdin when using `-test-io` · ba000628
      Andrzej Warzynski authored
      This patch adds logic in the InputOutputTestAction frontend action for
      reading input from stdin. Without this patch the following fails:
      ```
          flang-new -fc1 -test-io -
      ```
      
      The implementation of `InputOutputTestAction` is cleaned-up and a test
      for reading from stdin is added.
      
      Note that there's a difference between `-test-io` and e.g. `-E` in terms
      of file I/O. The frontend action for the former handles all file I/O on
      it's own. Conversely, the action corresponding to -E relies on the
      prescanner API to handle this.
      
      Currently we can't test reading from stdin for `flang-new -`. In this
      case `libclangDriver` assumes `-x -c`. This in turn leads to `flang-new
      -cc1`, which is not supported.
      ba000628
    • Louis Dionne's avatar
      [libc++] Remove the ability to use braced-init for filesystem paths · 1700ea73
      Louis Dionne authored
      According to my reading of http://eel.is/c++draft/filesystems#fs.class.path,
      the Standard doesn't actually mention that this should work. Since other
      implementations don't allow it, allowing it in libc++ is just setting a
      portability trap.
      
      Supersedes https://reviews.llvm.org/D89865.
      
      Differential Revision: https://reviews.llvm.org/D95975
      1700ea73
    • wlei's avatar
      [CSSPGO][llvm-profgen] Aggregate samples on call frame trie to speed up profile generation · 3869309a
      wlei authored
      For CS profile generation, the process of call stack unwinding is time-consuming since for each LBR entry we need linear time to generate the context( hash, compression, string concatenation). This change speeds up this by grouping all the call frame within one LBR sample into a trie and aggregating the result(sample counter) on it, deferring the context compression and string generation to the end of unwinding.
      
      Specifically, it uses `StackLeaf` as the top frame on the stack and manipulates(pop or push a trie node) it dynamically during virtual unwinding so that the raw sample can just be recoded on the leaf node, the path(root to leaf) will represent its calling context. In the end, it traverses the trie and generates the context on the fly.
      
      Results:
      Our internal branch shows about 5X speed-up on some large workloads in SPEC06 benchmark.
      
      Differential Revision: https://reviews.llvm.org/D94110
      3869309a
    • Louis Dionne's avatar
      [libc++] Make feature-test macros consistent with availability macros · 76fc3575
      Louis Dionne authored
      Before this patch, feature-test macros didn't take special availability
      markup into account, which means that feature-test macros can sometimes
      appear to "lie". For example, if you compile in C++20 mode and target
      macOS 10.13, the __cpp_lib_filesystem feature-test macro will be provided
      even though the <filesystem> declarations are marked as unavailable.
      This patch fixes that.
      
      rdar://68142369
      
      Differential Revision: https://reviews.llvm.org/D94983
      76fc3575
    • Louis Dionne's avatar
      85b9c5cc
    • David Spickett's avatar
      [clang][Arm] Fix handling of -Wa,-march= · 1d51c699
      David Spickett authored
      This fixes Bugzilla #48894 for Arm, where it
      was reported that -Wa,-march was not being handled
      by the integrated assembler.
      
      This was previously fixed for -Wa,-mthumb by
      parsing the argument in ToolChain::ComputeLLVMTriple
      instead of CollectArgsForIntegratedAssembler.
      It has to be done in the former because the Triple
      is read only by the time we get to the latter.
      
      Previously only mcpu would work via -Wa but only because
      "-target-cpu" is it's own option to cc1, which we were
      able to modify. Target architecture is part of "-target-triple".
      
      This change applies the same workaround to -march and cleans up
      handling of -Wa,-mcpu at the same time. There were some
      places where we were not using the last instance of an argument.
      
      The existing -Wa,-mthumb code was doing this correctly,
      so I've just added tests to confirm that.
      
      Now the same rules will apply to -Wa,-march/-mcpu as would
      if you just passed them to the compiler:
      * -Wa/-Xassembler options only apply to assembly files.
      * Architecture derived from mcpu beats any march options.
      * When there are multiple mcpu or multiple march, the last
        one wins.
      * If there is a compiler option and an assembler option of
        the same type, we prefer the one that fits the input type.
      * If there is an applicable mcpu option but it is overruled
        by an march, the cpu value is still used for the "-target-cpu"
        cc1 option.
      
      Reviewed By: nickdesaulniers
      
      Differential Revision: https://reviews.llvm.org/D95872
      1d51c699
    • Arnamoy Bhattacharyya's avatar
      [flang][driver] Add support for `-J/-module-dir` · 985a42fd
      Arnamoy Bhattacharyya authored
      Add support for option -J/-module-dir in the new Flang driver.  This
      will allow for including module files in other directories, as the
      default search path is currently the working folder. This also provides
      an option of storing the output module in the specified folder.
      
      Differential Revision: https://reviews.llvm.org/D95448
      985a42fd
    • Krzysztof Parzyszek's avatar
      [Hexagon] Add -mv68 option to driver · a83475d3
      Krzysztof Parzyszek authored
      a83475d3
    • Mark de Wever's avatar
      [libc++] Adds a make_string test helper function. · e275e629
      Mark de Wever authored
      These function makes it easier to write generic unit tests for the
      format header. It solves the issue where it's not possible to use
        `templated_prefix"foo"`
      where `templated_prefix` resolves to: nothing, `L`, `u8`, `u`,
      or `U`. The templated_prefix would be more faster during execution.
      
      Reviewed By: ldionne, #libc, curdeius
      
      Differential Revision: https://reviews.llvm.org/D93414
      e275e629
  2. Feb 04, 2021
    • Krzysztof Parzyszek's avatar
    • Sanjay Patel's avatar
      [InstCombine] add tests for demanded/known bits of shifted constant; NFC · 9d230295
      Sanjay Patel authored
      These are variations of a missed analysis noted in:
      https://llvm.org/PR48984
      9d230295
    • Dylan McKay's avatar
      [AVR] Fix up a few accidentally-regressed Generic CodeGen tests recently broken · b10df8f7
      Dylan McKay authored
      In 85e8e624, these tests were modified
      to work with AVR, but the regex matchers were finicky and required a
      fix forward patch, being this.
      b10df8f7
    • Louis Dionne's avatar
      [libc++] Rename include/support to include/__support · b5175681
      Louis Dionne authored
      We do ship those headers, so the directory name should not be something
      that can potentially conflict with user-defined directories.
      
      Differential Revision: https://reviews.llvm.org/D95956
      b5175681
    • Simon Pilgrim's avatar
    • Dylan McKay's avatar
      [AVR] Add 'XFAIL' to the remaining failing Generic CodeGen tests for AVR · 0d890e4c
      Dylan McKay authored
      This patch adds 'XFAIL: avr' to 2 Generic CodeGen tests, bringing the
      Generic CodeGen tests for AVR to a pass, with only two XFAILures.
      
      After this patch, the Generic CodeGen tests pass on AVR.
      0d890e4c
    • Dylan McKay's avatar
      [AVR] Fix 14 Generic CodeGen tests by making address space explicit or optional · 85e8e624
      Dylan McKay authored
      This fixes the vast majority of remaining failing AVR Generic CodeGen
      tests.
      85e8e624
    • Jeremy Morse's avatar
      [Dexter] Avoid infinite loop in dbgeng driver · c8e6cde9
      Jeremy Morse authored
      This method of the dbgeng debugger driver used to just "pass", as setting
      dbgeng free running still leads to numerous errors. This wasn't a problem
      in the past because, as it turns out, nothing called the go method.
      However, a recent refactor uses it.
      
      Rather than launch dbgeng free running, instead have it single step one
      step forwards. This is slow, but it makes progress, where previously we
      weren't.
      
      Differential Revision: https://reviews.llvm.org/D91737
      c8e6cde9
    • Andrzej Warzynski's avatar
      [flang][driver] Add PrescanAction frontend action (nfc) · d06e9403
      Andrzej Warzynski authored
      This new action encapsulates all actions that require the prescanner to
      be run before proceeding with other processing. By adding this new
      action, we are better equipped to control which actions _do_ run the
      prescanner and which _do not_.
      
      The following actions that require the prescanner are refactored to
      inherit from `PrescanAction`:
        * `PrintPreprocessedAction`
        * `ParseSyntaxOnlyAction` .
      
      New virtual method is introduced to facilitate all this:
        * `BeginSourceFileAction`
      Like in Clang, this method is run inside `BeginSourceFile`. In other
      words, it is invoked before `ExecuteAction` for the corresponding
      frontend action is run. This method allows us to:
        * carry out any processing that is always required by the action (e.g.
          run the prescanner)
        * fine tune the settings/options on a file-by-file basis (e.g. to
          decide between fixed-form and free-form based on file extension)
      
      This patch implements non-functional-changes.
      
      Reviewed By: FarisRehman
      
      Differential Revision: https://reviews.llvm.org/D95464
      d06e9403
    • Sander de Smalen's avatar
      NFC: Migrate LoopUnrollPass to work on InstructionCost · 75b2555d
      Sander de Smalen authored
      This patch migrates cost values and arithmetic to work on InstructionCost.
      When the interfaces to TargetTransformInfo are changed, any InstructionCost
      state will propagate naturally.
      
      See this patch for the introduction of the type: https://reviews.llvm.org/D91174
      See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
      
      Reviewed By: david-arm, fhahn
      
      Differential Revision: https://reviews.llvm.org/D95817
      75b2555d
    • Anastasia Stulova's avatar
      0fb43415
    • Florian Hahn's avatar
      [ConstraintElimination] Support conditions from loop preheaders · 703f6a68
      Florian Hahn authored
      This patch extends the condition collection logic to allow adding
      conditions from pre-headers to loop headers, by allowing cases where the
      target block dominates some of its predecessors.
      703f6a68
    • Anastasia Stulova's avatar
      [OpenCL] Fix default address space in template argument deduction. · 0c65993b
      Anastasia Stulova authored
      When deducing a reference type for forwarding references prevent
      adding default address space of a template argument if it is given.
      
      This got reported in PR48896 because in OpenCL all parameters are
      in private address space and therefore when we initialize a
      forwarding reference with a parameter we should just inherit the
      address space from it i.e. keep __private instead of __generic.
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D95624
      0c65993b
    • Alexander Belyaev's avatar
      09c18a66
    • Konstantin Zhuravlyov's avatar
      AMDGPU: Add support for amdgpu-unsafe-fp-atomics attribute · 6054a456
      Konstantin Zhuravlyov authored
      If amdgpu-unsafe-fp-atomics is specified, allow {flat|global}_atomic_add_f32 even if atomic modes don't match.
      
      Differential Revision: https://reviews.llvm.org/D95391
      6054a456
    • Dylan McKay's avatar
      [AVR] Remove an assertion that causes generic CodeGen tests to fail · 83e2710e
      Dylan McKay authored
      It was discussed a few years ago and agreed that it makes sense to
      remove this assertion as other targets do not perform similar register
      size checking in inline assembly constraint logic, so the check just
      adds a needless barrier on AVR.
      
      This patch removes the assertion and removes 'XFAIL' from two Generic
      CodeGen tests for AVR as a result.
      83e2710e
    • Andrzej Warzynski's avatar
      [clang] Add AddClang.cmake to the list of the CMake modules that are installed · 62e4f22e
      Andrzej Warzynski authored
      This makes sure that AddClang.cmake is installed alongside other Clang
      CMake modules. This mirrors LLVM and MLIR in this respect and is
      required when building the new Flang driver out of tree (as it depends
      on Clang and includes AddClang.cmake).
      
      Reviewed By: bogner
      
      Differential Revision: https://reviews.llvm.org/D94533
      62e4f22e
    • Faris Rehman's avatar
      [flang][driver] Add forced form flags and -ffixed-line-length · 3a1513c1
      Faris Rehman authored
      Add support for the following layout options:
      * -ffree-form
      * -ffixed-form
      - -ffixed-line-length=n (alias -ffixed-line-length-n)
      Additionally remove options `-fno-free-form` and `-fno-fixed-form` as they were initially added to forward to gfortran but gfortran does not support these flags.
      
      This patch adds the flag FlangOnlyOption to the existing options `-ffixed-form`, `-ffree-form` and `-ffree-line-length-` in Options.td. As of commit 6a754968, these flags are not currently forwarded to gfortran anyway.
      
      The default fixed line length in FrontendOptions is 72, based off the current default in Fortran::parser::Options. The line length cannot be set to a negative integer, or a positive integer less than 7 excluding 0, consistent with the behaviour of gfortran.
      
      This patch does not add `-ffree-line-length-n` as Fortran::parser::Options does not have a variable for free form columns.
      Whilst the `fixedFormColumns` variable is used in f18 for `-ffree-line-length-n`, f18 only allows `-ffree-line-length-none`/`-ffree-line-length-0` and not a user-specified value. `fixedFormcolumns` cannot be used in the new driver as it is ignored in the frontend when dealing with free form files.
      
      Summary of changes:
      - Remove -fno-fixed-form and -fno-free-form from Options.td
      - Make -ffixed-form, -ffree-form and -ffree-line-length-n FlangOnlyOption in Options.td
      - Create AddFortranDialectOptions method in Flang.cpp
      - Create FortranForm enum in FrontendOptions.h
      - Add fortranForm_ and fixedFormColumns_ to Fortran::frontend::FrontendOptions
      - Update fixed-form-test.f so that it guarantees that it fails when forced as a free form file to better facilitate testing.
      
      Differential Revision: https://reviews.llvm.org/D95460
      3a1513c1
    • Simon Pilgrim's avatar
      [X86] Remove stale TODO comment. NFC. · fa2cdb81
      Simon Pilgrim authored
      We now handle implicit zero-extension shuffle mask cases.
      fa2cdb81
    • Nico Weber's avatar
      Revert "[hip][cuda] Enable extended lambda support on Windows." · 4874ff02
      Nico Weber authored
      This reverts commit a2fdf9d4.
      Slightly speculative, seeing several cuda tests fail on this
      Windows bot: http://45.33.8.238/win/32620/step_7.txt
      4874ff02
    • Nico Weber's avatar
      [gn build] (manually) port 0609f257 · 26ca503b
      Nico Weber authored
      26ca503b
    • Sander de Smalen's avatar
      [ElementCount] NFC: Set 'const' qualifier for getWithIncrement/Decrement. · 8f69da9f
      Sander de Smalen authored
      These class methods simply return a new UnivariateLinearPolyBase
      (e.g. ElementCount), and do not modify the object in any way or form,
      so qualify for being 'const'.
      8f69da9f
    • Nicolas Vasilache's avatar
      [mlir][Linalg] Drop SliceOp · f4ac9f03
      Nicolas Vasilache authored
      This op is subsumed by rank-reducing SubViewOp and has become useless.
      
      Differential revision: https://reviews.llvm.org/D95317
      f4ac9f03
    • Jeremy Morse's avatar
      Re-land D94976 after revert in e29552c5 · 8998f584
      Jeremy Morse authored
      This modified patch avoids redirecting the unit in which a subprogram is
      created if type units are enabled -- DIEs were getting children allocated
      from different units memory pools. Original commit message:
      
      [DWARF] Create subprogram's DIE in DISubprogram's unit
      
      This is a fix for PR48790. Over in D70350, subprogram DIEs were permitted
      to be shared between CUs. However, the creation of a subprogram DIE can be
      triggered early, from other CUs. The subprogram definition is then created
      in one CU, and when the function is actually emitted children are attached
      to the subprogram that expect to be in another CU. This breaks internal CU
      references in the children.
      
      Fix this by redirecting the creation of subprogram DIEs in
      getOrCreateContextDIE to the CU specified by it's DISubprogram definition.
      This ensures that the subprogram DIE is always created in the correct CU.
      
      Differential Revision: https://reviews.llvm.org/D94976
      8998f584
    • David Green's avatar
      [ARM] Handle f16 in GeneratePerfectShuffle · 649a3d00
      David Green authored
      This new f16 shuffle under Neon would hit an assert in
      GeneratePerfectShuffle as it would try to treat a f16 vector as an i8.
      Add f16 handling, treating them like an i16.
      
      Differential Revision: https://reviews.llvm.org/D95446
      649a3d00
    • Alex Zinenko's avatar
      [mlir] make vector to llvm conversion truly partial · ba87f991
      Alex Zinenko authored
      Historically, the Vector to LLVM dialect conversion subsumed the Standard to
      LLVM dialect conversion patterns. This was necessary because the conversion
      infrastructure did not have sufficient support for reconciling type
      conversions. This support is now available. Only keep the patterns related to
      the Vector dialect in the Vector to LLVM conversion and require type casts
      operations to be inserted if necessary. These casts will be removed by
      following conversions if possible. Update integration tests to also run the
      Standard to LLVM conversion.
      
      There is a significant amount of test churn, which is due to (a) unnecessarily
      strict tests in VectorToLLVM and (b) many patterns actually targeting Standard
      dialect ops instead of LLVM dialect ops leading to tests actually exercising a
      Vector->Standard->LLVM conversion. This churn is a good illustration of the
      reason to make the conversion partial: now the tests only check the code in the
      Vector to LLVM conversion and will not be randomly broken by changes in
      Standard to LLVM conversion.
      
      Arguably, it may be possible to extract Vector to Standard patterns into a
      separate pass, but given the ongoing splitting of the Standard dialect, such
      pass will be short-lived and will require further refactoring.
      
      Depends On D95626
      
      Reviewed By: nicolasvasilache, aartbik
      
      Differential Revision: https://reviews.llvm.org/D95685
      ba87f991
    • Pavel Labath's avatar
      [lldb] Make TestLocalVariables.py compatible with the new pass manager · aa56b300
      Pavel Labath authored
      The new PM is more aggressive at inlining, which breaks assumptions in
      the test => slap some __attribute__((noinlines)) to prevent that.
      aa56b300
    • Alex Zinenko's avatar
      [mlir] Apply source materialization in case of transitive conversion · 5b91060d
      Alex Zinenko authored
      In dialect conversion infrastructure, source materialization applies as part of
      the finalization procedure to results of the newly produced operations that
      replace previously existing values with values having a different type.
      However, such operations may be created to replace operations created in other
      patterns. At this point, it is possible that the results of the _original_
      operation are still in use and have mismatching types, but the results of the
      _intermediate_ operation that performed the type change are not in use leading
      to the absence of source materialization. For example,
      
        %0 = dialect.produce : !dialect.A
        dialect.use %0 : !dialect.A
      
      can be replaced with
      
        %0 = dialect.other : !dialect.A
        %1 = dialect.produce : !dialect.A  // replaced, scheduled for removal
        dialect.use %1 : !dialect.A
      
      and then with
      
        %0 = dialect.final : !dialect.B
        %1 = dialect.other : !dialect.A    // replaced, scheduled for removal
        %2 = dialect.produce : !dialect.A  // replaced, scheduled for removal
        dialect.use %2 : !dialect.A
      
      in the same rewriting, but only the %1->%0 replacement is currently considered.
      
      Change the logic in dialect conversion to look up all values that were replaced
      by the given value and performing source materialization if any of those values
      is still in use with mismatching types. This is performed by computing the
      inverse value replacement mapping. This arguably expensive manipulation is
      performed only if there were some type-changing replacements. An alternative
      could be to consider all replaced operations and not only those that resulted
      in type changes, but it would harm pattern-level composability: the pattern
      that performed the non-type-changing replacement would have to be made aware of
      the type converter in order to call the materialization hook.
      
      Reviewed By: rriddle
      
      Differential Revision: https://reviews.llvm.org/D95626
      5b91060d
    • Hans Wennborg's avatar
      [clang-cl] Remove the /fallback option · 6625680a
      Hans Wennborg authored
      As discussed in
      https://lists.llvm.org/pipermail/cfe-dev/2021-January/067524.html
      
      It doesn't appear to be used, isn't really maintained, and adds some
      complexity to the code. Let's remove it.
      
      Differential revision: https://reviews.llvm.org/D95876
      6625680a
    • Jan Svoboda's avatar
      [clang][cli] Command line round-trip for HeaderSearch options · 225ccf0c
      Jan Svoboda authored
      This patch implements generation of remaining header search arguments.
      It's done manually in C++ as opposed to TableGen, because we need the flexibility and don't anticipate reuse.
      
      This patch also tests the generation of header search options via a round-trip. This way, the code gets exercised whenever Clang is built and tested in asserts mode. All `check-clang` tests pass.
      
      Reviewed By: dexonsmith
      
      Differential Revision: https://reviews.llvm.org/D94472
      225ccf0c
    • Joachim Meyer's avatar
      [Support] Indent multi-line descr of enum cli options. · e3f02302
      Joachim Meyer authored
      As noted in https://reviews.llvm.org/D93459, the formatting of
      multi-line descriptions of clEnumValN and the likes is unfavorable.
      Thus this patch adds support for correctly indenting these.
      
      Reviewed By: serge-sans-paille
      
      Differential Revision: https://reviews.llvm.org/D93494
      e3f02302