1. Oct 03, 2018
    • Zachary Turner's avatar
      [cl-compat] Change /JMC from unsupported to ignored. · be6edb3a
      Zachary Turner authored
      A tracking bug for actually implementing this in clang-cl is at
      https://bugs.llvm.org/show_bug.cgi?id=39156.
      
      Differential Revision: https://reviews.llvm.org/D52798
      
      llvm-svn: 343629
      be6edb3a
    • Ali Tamur's avatar
      Introduce a flag to warn when ifunc symbols are used with text relocations. · 63830b27
      Ali Tamur authored
      Summary:
      This patch adds a new flag, --warn-ifunc-textrel, to work around a glibc bug. When a code with ifunc symbols is used to produce an object file with text relocations, lld always succeeds. However, if that object file is linked using an old version of glibc, the resultant binary just crashes with segmentation fault when it is run (The bug is going to be corrected as of glibc 2.19).
      
      Since there is no way to tell beforehand what library the object file will be linked against in the future, there does not seem to be a fool-proof way for lld to give an error only in cases where the binary will crash. So, with this change (dated 2018-09-25), lld starts to give a warning, contingent on a new command line flag that does not have a gnu counter part. The default value for --warn-ifunc-textrel is false, so lld behaviour will not change unless the user explicitly asks lld to give a warning. Users that link with a glibc library with version 2.19 or newer, or does not use ifunc symbols, or does not generate object files with text relocations do not need to take any action. Other users may consider to start passing warn-ifunc-textrel to lld to get early warnings.
      
      Reviewers: ruiu, espindola
      
      Reviewed By: ruiu
      
      Subscribers: grimar, MaskRay, markj, emaste, arichardson, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D52430
      
      llvm-svn: 343628
      63830b27
    • Aaron Smith's avatar
      [CodeView] Only add the Scoped flag for an enum type when it has an immediate... · da0602c1
      Aaron Smith authored
       [CodeView] Only add the Scoped flag for an enum type when it has an immediate function scope to match MSVC
      
      Reviewers: rnk, zturner, llvm-commits
      
      Reviewed By: rnk
      
      Differential Revision: https://reviews.llvm.org/D52706
      
      llvm-svn: 343627
      da0602c1
    • Aaron Smith's avatar
      [CodeView] Emit function options for subprogram and member functions · 802b033d
      Aaron Smith authored
      Summary:
      Use the newly added DebugInfo (DI) Trivial flag, which indicates if a C++ record is trivial or not, to determine Codeview::FunctionOptions.
      
      Clang and MSVC generate slightly different Codeview for C++ records. For example, here is the C++ code for a class with a defaulted ctor,
      
             class C {
             public:
               C() = default;
             };
      
      Clang will produce a LF for the defaulted ctor while MSVC does not. For more details, refer to FIXMEs in the test cases in "function-options.ll" included with this set of changes.
      
      
      Reviewers: zturner, rnk, llvm-commits, aleksandr.urakov
      
      Reviewed By: rnk
      
      Subscribers: Hui, JDevlieghere
      
      Differential Revision: https://reviews.llvm.org/D45123
      
      llvm-svn: 343626
      802b033d
    • Adrian Prantl's avatar
      Remove unnecessary field · be50052a
      Adrian Prantl authored
      llvm-svn: 343624
      be50052a
    • Eric Liu's avatar
    • Sam McCall's avatar
      Reland r343589 "[clangd] Dex: add Corpus factory for iterators, rename, fold constant. NFC"" · a659d779
      Sam McCall authored
      This reverts commit r343610.
      
      llvm-svn: 343622
      a659d779
    • Matt Davis's avatar
      [llvm-mca] Remove unecessary forward decls. NFC. · 42425ccf
      Matt Davis authored
      This patch also removes an unecessary include.
      
      llvm-svn: 343621
      42425ccf
    • Kristof Umann's avatar
      [analyzer][NFC] Refactor functions in PlistDiagnostics to take AnalyzerOptions as parameter · 40271e4f
      Kristof Umann authored
      I intend to add a new flag macro-expnasions-as-events, and unfortunately
      I'll only be able to convert the macro piece into an event one once I'm
      about to emit it, due to the lack of an avaible Preprocessor object in
      the BugReporter.
      
      Differential Revision: https://reviews.llvm.org/D52787
      
      llvm-svn: 343620
      40271e4f
    • Jonathan Peyton's avatar
      [OpenMP] Shutdown library on Windows if possible for better OMPT behavior · 8bb8a92d
      Jonathan Peyton authored
      On Windows, child workers are terminated by the parent during the normal
      program exit process (ExitProcess()) and they are not able to finish generating
      their OpenMP events. We can force manual library shut down in __kmpc_end() to
      fix this at least for the cases where __kmpc_end() is properly inserted.
      
      Patch by Hansang Bae
      
      Differential Revision: https://reviews.llvm.org/D52628
      
      llvm-svn: 343619
      8bb8a92d
    • Jonas Hahnfeld's avatar
      [OpenMP][NVPTX] Simplify codegen for orphaned parallel, NFCI. · 3ca4701d
      Jonas Hahnfeld authored
      Worker threads fork off to the compiler generated worker function
      directly after entering the kernel function. Hence, there is no
      need to check whether the current thread is the master if we are
      outside of a parallel region (neither SPMD nor parallel_level > 0).
      
      Differential Revision: https://reviews.llvm.org/D52732
      
      llvm-svn: 343618
      3ca4701d
    • Jonas Hahnfeld's avatar
      [OpenMP] Simplify code for reductions on distribute directives, NFC. · 5aaaecea
      Jonas Hahnfeld authored
      Only need to care about the 'distribute simd' case, all other composite
      directives are handled elsewhere. This was already reflected in the
      outer 'if' condition, so all other inner conditions could never be true.
      
      Differential Revision: https://reviews.llvm.org/D52731
      
      llvm-svn: 343617
      5aaaecea
    • Matt Morehouse's avatar
      Revert "X86, AArch64, ARM: Do not attach debug location to spill/reload instructions" · 4b1ec17f
      Matt Morehouse authored
      This reverts r343520 due to breakage of HWASan tests on Android.
      
      llvm-svn: 343616
      4b1ec17f
    • Matt Davis's avatar
      [llvm-mca] Constify the 'notify' routines. NFC. · 21d41dff
      Matt Davis authored
      Also fixed up some whitespace formatting in DispatchStage.cpp.
      
      llvm-svn: 343615
      21d41dff
    • Craig Topper's avatar
      [X86][Disassembler] Add bizarro versions of the MOVSXD instruction that sign... · 49225d09
      Craig Topper authored
      [X86][Disassembler] Add bizarro versions of the MOVSXD instruction that sign extend from a GR32 to GR32 or GR16.
      
      The 0x63 opcodes in 64-bit mode have a fixed source size of 32-bits, but the destination size is controlled by REX.W and the 0x66 opsize prefix. This instruction is normally used with a REX.W prefix which provides desired behavior. The other encodings are interpretted as valid by the processor, but aren't useful.
      
      This patch makes us recognize them for the disassembler to match objdump.
      
      llvm-svn: 343614
      49225d09
    • Daniel Sanders's avatar
      [globalisel][verifier] Run the MachineVerifier from IRTranslator onwards · 74de21d0
      Daniel Sanders authored
      -verify-machineinstrs inserts the MachineVerifier after every MachineInstr-based
      pass. However, GlobalISel creates MachineInstr-based passes earlier than DAGISel
      and the corresponding verifiers are not being added. This patch fixes that.
      
      If GlobalISel triggers the fallback path then the MIR can be left in a bad
      state that is going to be cleared by ResetMachineFunctions. In this situation
      verifying between GlobalISel passes will prevent the fallback path from
      recovering from this. As a result, we bail out of verifying a function if the
      FailedISel attribute is present.
      
      llvm-svn: 343613
      74de21d0
    • Adrian Prantl's avatar
      DWARFExpression: Resolve file addresses in the linked module · f796e763
      Adrian Prantl authored
      This is a follow-up to https://reviews.llvm.org/D46362.
      
      When evaluating a complex expression in DWARFExpression::Evaluate,
      file addresses must be resolved to load addresses before we can
      perform operations such as DW_OP_deref on them.
      
      For this the address goes through three steps
      
      1. Read the file address as stored in the DWARF
      2. Link/relocate the file address (when reading from a .dSYM, this is a no-op)
      3. Convert the file address to a load address.
      
      D46362 implemented step (3) by resolving the file address using the
      Module that the original DWARF came from. In the case of a dSYM that
      is correct, but when reading from .o files, we need to look up
      relocated/linked addresses, so the right place to look them up is the
      current frame's module. This patch fixes that by setting the
      expression's Module to point to the linked debugmap object.
      
      A word a bout the unorthodox testcase: The motivating testcase for
      this fix is in Swift, but I managed to hand-modify LLVM-IR for a
      trivial C program to exhibit the same problem, so we can fix this in
      llvm.org.
      
      rdar://problem/44689915
      
      Differential Revision: https://reviews.llvm.org/D52678
      
      llvm-svn: 343612
      f796e763
    • Yaxun Liu's avatar
      [HIP] Support early finalization of device code for -fno-gpu-rdc · 9767089d
      Yaxun Liu authored
      This patch renames -f{no-}cuda-rdc to -f{no-}gpu-rdc and keeps the original
      options as aliases. When -fgpu-rdc is off,
      clang will assume the device code in each translation unit does not call
      external functions except those in the device library, therefore it is possible
      to compile the device code in each translation unit to self-contained kernels
      and embed them in the host object, so that the host object behaves like
      usual host object which can be linked by lld.
      
      The benefits of this feature is: 1. allow users to create static libraries which
      can be linked by host linker; 2. amortized device code linking time.
      
      This patch modifies HIP action builder to insert actions for linking device
      code and generating HIP fatbin, and pass HIP fatbin to host backend action.
      It extracts code for constructing command for generating HIP fatbin as
      a function so that it can be reused by early finalization. It also modifies
      codegen of HIP host constructor functions to embed the device fatbin
      when it is available.
      
      Differential Revision: https://reviews.llvm.org/D52377
      
      llvm-svn: 343611
      9767089d
    • Reid Kleckner's avatar
      Revert r343589 "[clangd] Dex: add Corpus factory for iterators, rename, fold constant. NFC" · 2b5259af
      Reid Kleckner authored
      Declaring a field with the same name as a type causes GCC to error out:
      
      Dex.h:104:10: error: declaration of 'clang::clangd::dex::Corpus clang::clangd::dex::Dex::Corpus' [-fpermissive]
         Corpus Corpus;
                ^
      Iterator.h:127:7: error: changes meaning of 'Corpus' from 'class clang::clangd::dex::Corpus' [-fpermissive]
       class Corpus {
      
      llvm-svn: 343610
      2b5259af
    • Tatyana Krasnukha's avatar
      Remove GetPythonDir declaration from HostInfoBase class · f85f1408
      Tatyana Krasnukha authored
      llvm-svn: 343609
      f85f1408
    • Haojian Wu's avatar
      [clangd] Don't make check-clangd as a dependency in check-clang-tools · 795f6ed5
      Haojian Wu authored
      Summary:
      check-clang-tools will run check-clangd first, and then run the rest
      tests. If clangd tests fails, check-clang-tools would be stopped.
      
      This would block other clang-tools developers if clangd is broken.
      
      Reviewers: sammccall
      
      Subscribers: mgorny, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D52781
      
      llvm-svn: 343608
      795f6ed5
    • Petr Hosek's avatar
      [lib/fuzzer] Fix logging for Fuchsia · a70ece45
      Petr Hosek authored
      This change fixes two aspects of logging on Fuchsia:
      
      1. When logging to stdout, the output file descriptor should not be
      closed in ExecuteCommand, as it prevent fdio_spawn_etc from succeeding
      in subsequent calls.
      2. When logging to a file in anything other than standalone Zircon, the
      log file needs to be created in mutable storage. The best indicator
      where this is relative to the Fuchsia component will be given by
      '-artifact_prefix=...', so save the log file relative to that path.
      
      Patch by: aarongreen
      Differential Revision: https://reviews.llvm.org/D52562
      
      llvm-svn: 343607
      a70ece45
    • David Major's avatar
      Reland r342652 "[winasan] Unpoison the stack in NtTerminateThread" · 6d6c9150
      David Major authored
      In long-running builds we've seen some ASan complaints during thread creation that we suspect are due to leftover poisoning from previous threads whose stacks occupied that memory. This patch adds a hook that unpoisons the stack just before the NtTerminateThread syscall.
      
      Differential Revision: https://reviews.llvm.org/D52091
      
      llvm-svn: 343606
      6d6c9150
    • Vitaly Buka's avatar
      [sanitizer] Include inlined frames into __sanitizer_symbolize_pc output · 83e57e21
      Vitaly Buka authored
      Summary:
      Behavior for existing used is not changing as the first line is going
      to be the same, and it was invalid to try to read more lines.
      
      New clients can read until they get empty string.
      
      Reviewers: eugenis, morehouse
      
      Subscribers: kubamracek, eraman, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D52743
      
      llvm-svn: 343605
      83e57e21
    • Diogo N. Sampaio's avatar
      [NFC][BUG-FIX][ARM] Add missing data symbol · a35e55ef
      Diogo N. Sampaio authored
      llvm rL343594: [ARM] Emmit data symbol
      for constant pool data fixed a bug that ommited
      required data symbols.
      Such change breaked a test case in lld:
      test/ELF/arm-thunk-largesection.s
      
      llvm-svn: 343604
      a35e55ef
    • Reid Kleckner's avatar
      [codeview] Fix 32-bit x86 variable locations in realigned stack frames · d5e4ec74
      Reid Kleckner authored
      Add the .cv_fpo_stackalign directive so that we can define $T0, or the
      VFRAME virtual register, with it. This was overlooked in the initial
      implementation because unlike MSVC, we push CSRs before allocating stack
      space, so this value is only needed to describe local variable
      locations. Variables that the compiler now addresses via ESP are instead
      described as being stored at offsets from VFRAME, which for us is ESP
      after alignment in the prologue.
      
      This adds tests that show that we use the VFRAME register properly in
      our S_DEFRANGE records, and that we emit the correct FPO data to define
      it.
      
      Fixes PR38857
      
      llvm-svn: 343603
      d5e4ec74
    • Francois Ferrand's avatar
      clang-format: better handle statement macros · 6f40e21a
      Francois Ferrand authored
      Summary:
      Some macros are used in the body of function, and actually contain the trailing semicolon: they should thus be automatically followed by a new line, and not get merged with the next line. This is for example the case with Qt's Q_UNUSED macro:
      
        void foo(int a, int b) {
          Q_UNUSED(a)
          return b;
        }
      
      This patch deals with these cases by introducing a new option to specify list of statement macros. This re-uses the system already in place for foreach macros, to ensure there is no impact on performance.
      
      Reviewers: krasimir, djasper, klimek
      
      Reviewed By: krasimir
      
      Subscribers: acoomans, mgrang, alexfh, klimek, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D33440
      
      llvm-svn: 343602
      6f40e21a
    • Kristina Brooks's avatar
      [Arm builtins] Remove non-necessary IS check · 59500f7a
      Kristina Brooks authored
      This patch removes the instruction set check to make the msr APSR_nzcvq,
      ip instruction only execute if Thumb2 is used.
      The APSR is a subset of the bits of the CPSR
      (B.1.3.3 of the Arm v7 A and R ARM [1]) and is only available for A and
      R profiles.
      However in section B.9.3.11 of the same document we see that:
      
      "In the A and R profiles, APSR_nzcvq is the same as CPSR_f"
      "ARM recommends the APSR forms when only the N, Z, C, V, Q, and GE[3:0]
      bits are being written."
      
      This patch also make those files assemble for Armv8-M Mainline
      architecture profile.
      
      The builtins were cross-compiled for Arm, Aarch64 and Armv6-M, Armv7-M
      and Armv7E-M targets.
      Cross-compiled tests were executed for Arm target.
      
      [1]: https://developer.arm.com/docs/ddi0406/latest/arm-architecture-reference-manual-armv7-a-and-armv7-r-edition
      
      Patch by hug-dev (Hugues de Valon).
      
      Differential Revision: https://reviews.llvm.org/D51854
      
      llvm-svn: 343601
      59500f7a
    • Jessica Paquette's avatar
      9cfc8eca
    • Stephen Hines's avatar
      [sanitizer] Use -Wl,-z,global on Android for sanitizers except UBsan · 80e7d65a
      Stephen Hines authored
      Summary:
      This essentially reverts r337010 since it breaks UBSan, which is used
      for a few platform libraries. The "-z global" flag is now added for
      Scudo as well. The only other sanitizer shared libraries are for asan
      and hwasan, which have also been reinstated to use the global flag.
      
      Reviewers: cryptoad, eugenis
      
      Reviewed By: cryptoad
      
      Subscribers: kubamracek, mgorny, delcypher, #sanitizers, nickdesaulniers, chh, kongyi, pirama, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D52770
      
      llvm-svn: 343599
      80e7d65a
  2. Oct 02, 2018