1. Aug 27, 2020
  2. Aug 26, 2020
    • Craig Topper's avatar
      [X86] Correct the implementation of the testFeature macro in... · 761cd1ce
      Craig Topper authored
      [X86] Correct the implementation of the testFeature macro in getIntelProcessorTypeAndSubtype to do a proper bit test.
      
      Instead of ANDing with a one hot mask representing the bit to
      be tested, we were ANDing with just the bit number. This tests
      multiple bits none of them the correct one.
      
      This caused skylake-avx512, cascadelake and cooperlake to all
      be misdetected. Based on experiments with the Intel SDE, it seems
      that all of these CPUs are being detected as being cooperlake.
      This is bad since its the newest CPU of the 3.
      
      (cherry picked from commit df9a9bb7)
      761cd1ce
    • Fangrui Song's avatar
      [ELF] -r: allow SHT_X86_64_UNWIND to be merged into SHT_PROGBITS · 04d70cd0
      Fangrui Song authored
      * For .cfi_*, GCC/GNU as emits SHT_PROGBITS type .eh_frame sections.
      * Since rL252300, clang emits SHT_X86_64_UNWIND type .eh_frame sections
        (originated from Solaris, documented in the x86-64 psABI).
      * Some assembly use `.section .eh_frame,"a",@unwind` to generate
        SHT_X86_64_UNWIND .eh_frame sections.
      
      In a non-relocatable link, input .eh_frame are combined and there is
      only one SyntheticSection .eh_frame in the output section, so the
      "section type mismatch" diagnostic does not fire.
      
      In a relocatable link, there is no SyntheticSection .eh_frame. .eh_frame of
      mixed types can trigger the diagnostic. This patch fixes it by adding another
      special case 0x70000001 (= SHT_X86_64_UNWIND) to canMergeToProgbits().
      
          ld.lld -r gcc.o clang.o => error: section type mismatch for .eh_frame
      
      There was a discussion "RFC: Usefulness of SHT_X86_64_UNWIND" on the x86-64-abi
      mailing list. Folks are not wild about making the psABI value 0x70000001 into
      gABI, but a few think defining 0x70000001 for .eh_frame may be a good idea for a
      new architecture.
      
      Reviewed By: grimar
      
      Differential Revision: https://reviews.llvm.org/D85785
      
      (cherry picked from commit 88498f44)
      04d70cd0
    • Hans Wennborg's avatar
      Bump -len_control value in fuzzer-custommutator.test (PR47286) · 46f3aed1
      Hans Wennborg authored
      to make the test more stable, as suggested by mmoroz.
      
      (cherry picked from commit 84215033)
      46f3aed1
    • Francesco Petrogalli's avatar
    • Teresa Johnson's avatar
      [Docs] Document --lto-whole-program-visibility · ce9f3f19
      Teresa Johnson authored
      Summary:
      Documents interaction of linker option added in D71913 with LTO
      visibility.
      
      Reviewers: pcc
      
      Subscribers: inglorion, hiraditya, steven_wu, dexonsmith, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D75655
      
      (cherry picked from commit 72bdb41a)
      ce9f3f19
    • Fangrui Song's avatar
      [ELF] --gdb-index: skip SHF_GROUP .debug_info · 21d01a67
      Fangrui Song authored
      -gdwarf-5 -fdebug-types-section may produce multiple .debug_info sections.  All
      except one are type units (.debug_types before DWARF v5). When constructing
      .gdb_index, we should ignore these type units. We use a simple heuristic: the
      compile unit does not have the SHF_GROUP flag. (This needs to be revisited if
      people place compile unit .debug_info in COMDAT groups.)
      
      This issue manifests as a data race: because an object file may have multiple
      .debug_info sections, we may concurrently construct `LLDDwarfObj` for the same
      file in multiple threads. The threads may access `InputSectionBase::data()`
      concurrently on the same input section. `InputSectionBase::data()` does a lazy
      uncompress() and rewrites the member variable `rawData`. A thread running zlib
      `inflate()` (transitively called by uncompress()) on a buffer with `rawData`
      tampered by another thread may fail with `uncompress failed: zlib error: Z_DATA_ERROR`.
      
      Even if no data race occurred in an optimistic run, if there are N .debug_info,
      one CU entry and its address ranges will be replicated N times. The result
      .gdb_index can be much larger than a correct one.
      
      The new test gdb-index-dwarf5-type-unit.s actually has two compile units. This
      cannot be produced with regular approaches (it can be produced with -r
      --unique). This is used to demonstrate that the .gdb_index construction code
      only considers the last non-SHF_GROUP .debug_info
      
      Reviewed By: grimar
      
      Differential Revision: https://reviews.llvm.org/D85579
      
      (cherry picked from commit fb141292)
      21d01a67
    • Hans Wennborg's avatar
      ReleaseNotes: removal of llgo · 03c8e1cc
      Hans Wennborg authored
      03c8e1cc
  3. Aug 25, 2020
    • QingShan Zhang's avatar
      [DAGCombine] Remove dead node when it is created by getNegatedExpression · 4d16d8df
      QingShan Zhang authored
      We hit the compiling time reported by https://bugs.llvm.org/show_bug.cgi?id=46877
      and the reason is the same as D77319. So we need to remove the dead node we created
      to avoid increase the problem size of DAGCombiner.
      
      Reviewed By: Spatel
      
      Differential Revision: https://reviews.llvm.org/D86183
      
      (cherry picked from commit 960cbc53)
      4d16d8df
    • Hans Wennborg's avatar
    • Johannes Doerfert's avatar
      Do not use TBAA in type punning reduction GPU code PR46156 · 1274d834
      Johannes Doerfert authored
      When we implement OpenMP GPU reductions we use type punning a lot during
      the shuffle and reduce operations. This is not always compatible with
      language rules on aliasing. So far we generated TBAA which later allowed
      to remove some of the reduce code as accesses and initialization were
      "known to not alias". With this patch we avoid TBAA in this step,
      hopefully for all accesses that we need to.
      
      Verified on the reproducer of PR46156 and QMCPack.
      
      Reviewed By: ABataev
      
      Differential Revision: https://reviews.llvm.org/D86037
      1274d834
    • Johannes Doerfert's avatar
      Reuse OMPIRBuilder `struct ident_t` handling in Clang · 9f4a92a4
      Johannes Doerfert authored
      Replace the `ident_t` handling in Clang with the methods offered by the
      OMPIRBuilder. This cuts down on the clang code as well as the
      differences between the two, making further transitions easier. Tests
      have changed but there should not be a real functional change. The most
      interesting difference is probably that we stop generating local ident_t
      allocations for now and just use globals. Given that this happens only
      with debug info, the location part of the `ident_t` is probably bigger
      than the test anyway. As the location part is already a global, we can
      avoid the allocation, memcpy, and store in favor of a constant global
      that is slightly bigger. This can be revisited if there are
      complications.
      
      Reviewed By: ABataev
      
      Differential Revision: https://reviews.llvm.org/D80735
      9f4a92a4
    • Richard Smith's avatar
      PR37556: Don't diagnose conflicts between instantiated unqualified · c160ff15
      Richard Smith authored
      friend declarations and declarations found in inline namespaces within
      the target context.
      
      (cherry picked from commit 04ba1856)
      c160ff15
    • Ryan Prichard's avatar
      [libunwind] Make findUnwindSectionsByPhdr static · 83338bed
      Ryan Prichard authored
      Currently, this function is present in the dynsym table of
      libunwind.so (on ELF targets). Make the function static instead.
      
      In the previous release (LLVM 10.x), this function was instead a lambda
      function inside LocalAddressSpace::findUnwindSections, and because
      LocalAddressSpace was marked with _LIBUNWIND_HIDDEN, the lambda
      function was also a hidden symbol.
      
      Differential Revision: https://reviews.llvm.org/D86372
      
      (cherry picked from commit 3c1b2e33)
      83338bed
    • Amy Huang's avatar
      Revert "Switch to using -debug-info-kind=constructor as default (from =limited)" · 90c2c51a
      Amy Huang authored
      This reverts commit 227db86a.
      
      Causing debug info errors in google3 LTO builds; also causes a
      debuginfo-test failure.
      
      (cherry picked from commit 394db225)
      90c2c51a
    • Brad Smith's avatar
    • Brad Smith's avatar
      [clang][Driver] Implement AddClangSystemIncludeArgs and HasNativeLLVMSupport... · 0c001a17
      Brad Smith authored
      [clang][Driver] Implement AddClangSystemIncludeArgs and HasNativeLLVMSupport for the OpenBSD clang driver.
      
      If not overridden, AddClangSystemIncludeArgs's implementation is empty, so by
      default, no system include args are added to the Clang driver. This means that
      invoking Clang without the frontend must include a manual -I/usr/include flag,
      which is inconsistent behavior. Therefore, override and implement this method
      to match. Some boilerplate is also borrowed for handling of the other driver
      flags.
      
      While we are here, also override and enable HasNativeLLVMSupport.
      
      Patch by: 3405691582 (dana koch)
      
      Differential Revision: https://reviews.llvm.org/D86412
      
      (cherry picked from commit 2b37174b)
      0c001a17
    • Dimitry Andric's avatar
      Instantiate Error in Target::GetEntryPointAddress() only when necessary · 6406b6fa
      Dimitry Andric authored
      When `Target::GetEntryPointAddress()` calls `exe_module->GetObjectFile()->GetEntryPointAddress()`, and the returned
      `entry_addr` is valid, it can immediately be returned.
      
      However, just before that, an `llvm::Error` value has been setup, but in this case it is not consumed before returning, like is done further below in the function.
      
      In https://bugs.freebsd.org/248745 we got a bug report for this, where a very simple test case aborts and dumps core:
      
      ```
      * thread #1, name = 'testcase', stop reason = breakpoint 1.1
          frame #0: 0x00000000002018d4 testcase`main(argc=1, argv=0x00007fffffffea18) at testcase.c:3:5
         1	int main(int argc, char *argv[])
         2	{
      -> 3	    return 0;
         4	}
      (lldb) p argc
      Program aborted due to an unhandled Error:
      Error value was Success. (Note: Success values must still be checked prior to being destroyed).
      
      Thread 1 received signal SIGABRT, Aborted.
      thr_kill () at thr_kill.S:3
      3	thr_kill.S: No such file or directory.
      (gdb) bt
      #0  thr_kill () at thr_kill.S:3
      #1  0x00000008049a0004 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52
      #2  0x0000000804916229 in abort () at /usr/src/lib/libc/stdlib/abort.c:67
      #3  0x000000000451b5f5 in fatalUncheckedError () at /usr/src/contrib/llvm-project/llvm/lib/Support/Error.cpp:112
      #4  0x00000000019cf008 in GetEntryPointAddress () at /usr/src/contrib/llvm-project/llvm/include/llvm/Support/Error.h:267
      #5  0x0000000001bccbd8 in ConstructorSetup () at /usr/src/contrib/llvm-project/lldb/source/Target/ThreadPlanCallFunction.cpp:67
      #6  0x0000000001bcd2c0 in ThreadPlanCallFunction () at /usr/src/contrib/llvm-project/lldb/source/Target/ThreadPlanCallFunction.cpp:114
      #7  0x00000000020076d4 in InferiorCallMmap () at /usr/src/contrib/llvm-project/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp:97
      #8  0x0000000001f4be33 in DoAllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp:604
      #9  0x0000000001fe51b9 in AllocatePage () at /usr/src/contrib/llvm-project/lldb/source/Target/Memory.cpp:347
      #10 0x0000000001fe5385 in AllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Target/Memory.cpp:383
      #11 0x0000000001974da2 in AllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Target/Process.cpp:2301
      #12 CanJIT () at /usr/src/contrib/llvm-project/lldb/source/Target/Process.cpp:2331
      #13 0x0000000001a1bf3d in Evaluate () at /usr/src/contrib/llvm-project/lldb/source/Expression/UserExpression.cpp:190
      #14 0x00000000019ce7a2 in EvaluateExpression () at /usr/src/contrib/llvm-project/lldb/source/Target/Target.cpp:2372
      #15 0x0000000001ad784c in EvaluateExpression () at /usr/src/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp:414
      #16 0x0000000001ad86ae in DoExecute () at /usr/src/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp:646
      #17 0x0000000001a5e3ed in Execute () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandObject.cpp:1003
      #18 0x0000000001a6c4a3 in HandleCommand () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:1762
      #19 0x0000000001a6f98c in IOHandlerInputComplete () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2760
      #20 0x0000000001a90b08 in Run () at /usr/src/contrib/llvm-project/lldb/source/Core/IOHandler.cpp:548
      #21 0x00000000019a6c6a in ExecuteIOHandlers () at /usr/src/contrib/llvm-project/lldb/source/Core/Debugger.cpp:903
      #22 0x0000000001a70337 in RunCommandInterpreter () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2946
      #23 0x0000000001d9d812 in RunCommandInterpreter () at /usr/src/contrib/llvm-project/lldb/source/API/SBDebugger.cpp:1169
      #24 0x0000000001918be8 in MainLoop () at /usr/src/contrib/llvm-project/lldb/tools/driver/Driver.cpp:675
      #25 0x000000000191a114 in main () at /usr/src/contrib/llvm-project/lldb/tools/driver/Driver.cpp:890```
      
      Fix the incorrect error catch by only instantiating an `Error` object if it is necessary.
      
      Reviewed By: JDevlieghere
      
      Differential Revision: https://reviews.llvm.org/D86355
      
      (cherry picked from commit 1ce07cd6)
      6406b6fa
    • Fangrui Song's avatar
      [ELF] Keep st_type for symbol assignment · c4e21671
      Fangrui Song authored
      PR46970: for `alias = aliasee`, the alias can be used in relocation processing
      and on ARM st_type does affect Thumb interworking. It is thus desirable for the
      alias to get the same st_type.
      
      Note that the st_size field should not be inherited because some tools use
      st_size=0 as a heuristic to detect aliases. Retaining st_size can thwart such
      heuristics and cause aliases to be preferred over the original symbols.
      
      Differential Revision: https://reviews.llvm.org/D86263
      
      (cherry picked from commit 9670029b)
      The test symbol-assign-type.s was rewritten to not depend on 'split-file'.
      c4e21671
    • Fangrui Song's avatar
      [ELF][test] Fix some llvm-objdump RUN lines which don't actually test anything · d6d03d09
      Fangrui Song authored
      (cherry picked from commit ac46bc35)
      d6d03d09
    • Kang Zhang's avatar
      [PowerPC] Fix a typo for InstAlias of mfsprg · dcdf2aff
      Kang Zhang authored
      D77531 has a type for mfsprg, it should be mtsprg. This patch is to fix
      this typo.
      
      (cherry picked from commit 95e18b2d)
      dcdf2aff
    • Mott, Jeffrey T's avatar
      Disable use of _ExtInt with '__atomic' builtins · 82e48a57
      Mott, Jeffrey T authored
      We're (temporarily) disabling ExtInt for the '__atomic' builtins so we can better design their behavior later. The idea is until we do an audit/design for the way atomic builtins are supposed to work with _ExtInt, we should leave them restricted so they don't limit our future options, such as by binding us to a sub-optimal implementation via ABI.
      
      Example after this change:
      
          $ cat test.c
      
              void f(_ExtInt(64) *ptr) {
                __atomic_fetch_add(ptr, 1, 0);
              }
      
          $ clang -c test.c
      
              test.c:2:22: error: argument to atomic builtin of type '_ExtInt' is not supported
                __atomic_fetch_add(ptr, 1, 0);
                                   ^
              1 error generated.
      
      Differential Revision: https://reviews.llvm.org/D84049
      
      (cherry picked from commit ca77ab49)
      82e48a57
    • Bas Zalmstra's avatar
      [LLD][COFF] Reset outputSections for successive runs · 0c37a916
      Bas Zalmstra authored
      The global variable outputSections in the COFF writer was not
      cleared between runs which caused successive calls to lld::coff::link
      to generate invalid binaries. These binaries when loaded would result
      in "invalid win32 applications" and/or "bad image" errors.
      
      Differential Revision: https://reviews.llvm.org/D86401
      
      (cherry picked from commit 54f5a4ea)
      0c37a916
    • Josh Stone's avatar
      lld: link libatomic if needed for Timer · 1708358f
      Josh Stone authored
      D80298 made Timer::total atomic, but this requires linking libatomic
      on some targets.
      
      Reviewed By: aaronpuchert
      
      Differential Revision: https://reviews.llvm.org/D85691
      
      (cherry picked from commit b26b32b5)
      1708358f
  4. Aug 21, 2020
  5. Aug 20, 2020
  6. Aug 19, 2020