and though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here

  1. 19 May, 2020 11 commits
  2. 07 May, 2020 9 commits
    • George Burgess IV's avatar
      [CodeGen] fix inline builtin-related breakage from D78162 · eaae6dfc
      George Burgess IV authored
      In cases where we have multiple decls of an inline builtin, we may need
      to go hunting for the one with a definition when setting function
      attributes.
      
      An additional test-case was provided on
      https://github.com/ClangBuiltLinux/linux/issues/979
      
      (cherry picked from commit 94908088)
      eaae6dfc
    • George Burgess IV's avatar
      [CodeGen] only add nobuiltin to inline builtins if we'll emit them · 3ab301b4
      George Burgess IV authored
      There are some inline builtin definitions that we can't emit
      (isTriviallyRecursive & callers go into why). Marking these
      nobuiltin is only useful if we actually emit the body, so don't mark
      these as such unless we _do_ plan on emitting that.
      
      This suboptimality was encountered in Linux (see some discussion on
      D71082, and https://github.com/ClangBuiltLinux/linux/issues/979).
      
      Differential Revision: https://reviews.llvm.org/D78162
      
      (cherry picked from commit 2dd17ff0)
      3ab301b4
    • Calixte Denizet's avatar
      [profile] Don't crash when forking in several threads · f082d918
      Calixte Denizet authored
      Summary:
      When forking in several threads, the counters were written out in using the same global static variables (see GCDAProfiling.c): that leads to crashes.
      So when there is a fork, the counters are resetted in the child process and they will be dumped at exit using the interprocess file locking.
      When there is an exec, the counters are written out and in case of failures they're resetted.
      
      Reviewers: jfb, vsk, marco-c, serge-sans-paille
      
      Reviewed By: marco-c, serge-sans-paille
      
      Subscribers: llvm-commits, serge-sans-paille, dmajor, cfe-commits, hiraditya, dexonsmith, #sanitizers, marco-c, sylvestre.ledru
      
      Tags: #sanitizers, #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D78477
      
      (cherry picked from commit bec223a9)
      f082d918
    • mydeveloperday's avatar
      [clang-format] [PR45357] Fix issue found with operator spacing · baeb500a
      mydeveloperday authored
      Summary:
      This is a tentative fix for https://bugs.llvm.org/show_bug.cgi?id=45357
      
      Spaces seem to be introduced between * and * due to changes brought in for {D69573}
      
      Reviewers: sylvestre.ledru, mitchell-stellar, sammccall, Abpostelnicu, krasimir, jbcoe
      
      Reviewed By: Abpostelnicu
      
      Subscribers: tstellar, hans, Abpostelnicu, cfe-commits
      
      Tags: #clang, #clang-format
      
      Differential Revision: https://reviews.llvm.org/D78879
      
      (cherry picked from commit b01dca50)
      baeb500a
    • Hans Wennborg's avatar
      clang-format: Fix pointer alignment for overloaded operators (PR45107) · 7ae6db9c
      Hans Wennborg authored
      This fixes a regression from D69573 which broke the following example:
      
        $ echo 'operator C<T>*();' | bin/clang-format --style=Chromium
        operator C<T> *();
      
      (There should be no space before the asterisk.)
      
      It seems the problem is in TokenAnnotator::spaceRequiredBetween(),
      which only looked at the token to the left of the * to see if it was a
      type or not. That code only handled simple types or identifiers, not
      templates or qualified types. This patch addresses that.
      
      Differential revision: https://reviews.llvm.org/D76850
      
      (cherry picked from commit eb85e903)
      7ae6db9c
    • Jan Korous's avatar
      [libclang] Remove duplicate dependency on LLVMSupport · db810b69
      Jan Korous authored
      Differential Revision: https://reviews.llvm.org/D79451
      
      (cherry picked from commit 02b30332)
      db810b69
    • David Green's avatar
      [MachineSink] Fix for breaking phi edges with instructions with multiple defs · bab8d179
      David Green authored
      BreakPHIEdge would be set based on whether the instruction needs to
      insert a new critical edge to allow sinking into a block where the uses
      are PHI nodes. But for instructions with multiple defs it would be reset
      on the second def, allowing the instruciton to sink where it should not.
      
      Fixes PR44981
      
      Differential Revision: https://reviews.llvm.org/D78087
      
      (cherry picked from commit 44c4ba34)
      bab8d179
    • Aaron Puchert's avatar
      PR45000: Let Sema::SubstParmVarDecl handle default args of lambdas in initializers · 9c80516d
      Aaron Puchert authored
      Summary:
      We extend the behavior for local functions and methods of local classes
      to lambdas in variable initializers. The initializer is not a separate
      scope, but we treat it as such.
      
      We also remove the (faulty) instantiation of default arguments in
      TreeTransform::TransformLambdaExpr, because it doesn't do proper
      initialization, and if it did, we would do it twice (and thus also emit
      eventual errors twice).
      
      Reviewed By: rsmith
      
      Differential Revision: https://reviews.llvm.org/D76038
      
      (cherry picked from commit f43859a0)
      9c80516d
    • Yonghong Song's avatar
      BPF: fix a CORE optimization bug · 1d1469ab
      Yonghong Song authored
      For the test case in this patch like below
        struct t { int a; } __attribute__((preserve_access_index));
        int foo(void *);
        int test(struct t *arg) {
            long param[1];
            param[0] = (long)&arg->a;
            return foo(param);
        }
      
      The IR right before BPF SimplifyPatchable phase:
        %1:gpr = LD_imm64 @"llvm.t:0:0$0:0"
        %2:gpr = LDD killed %1:gpr, 0
        %3:gpr = ADD_rr %0:gpr(tied-def 0), killed %2:gpr
        STD killed %3:gpr, %stack.0.param, 0
      After SimplifyPatchable phase, the incorrect IR is generated:
        %1:gpr = LD_imm64 @"llvm.t:0:0$0:0"
        %3:gpr = ADD_rr %0:gpr(tied-def 0), killed %1:gpr
        CORE_MEM killed %3:gpr, 306, %0:gpr, @"llvm.t:0:0$0:0"
      
      Note that CORE_MEM pseudo op is introduced to encode
      memory operations related to CORE. In the above, we intend
      to check whether we have a store like
         *(%3:gpr + 0) = ...
      and if this is the case, we could replace it with
         *(%0:gpr + @"llvm.t:0:0$0:0"_ = ...
      
      Unfortunately, in the above, IR for the store is
         *(%stack.0.param + 0) = %3:gpr
      and transformation should not happen.
      
      Note that we won't have problem if the actual CORE
      dereference (arg->a) happens.
      
      This patch fixed the problem by skip CORE optimization if
      the use of ADD_rr result is not the base address of the store
      operation.
      
      Differential Revision: https://reviews.llvm.org/D78466
      
      (cherry picked from commit 3cb7e7bf)
      1d1469ab
  3. 06 May, 2020 1 commit
  4. 04 May, 2020 1 commit
    • Fangrui Song's avatar
      [llvm-objcopy] Avoid invalid Sec.Offset after D79229 · 8e7ae355
      Fangrui Song authored
      To avoid undefined behavior caught by -fsanitize=undefined on binary-paddr.test
      
        void SectionWriter::visit(const Section &Sec) {
          if (Sec.Type != SHT_NOBITS)
            // Sec.Contents is empty while Sec.Offset may be out of bound
            llvm::copy(Sec.Contents, Out.getBufferStart() + Sec.Offset);
        }
      
      (cherry picked from commit 762fb1c4)
      8e7ae355
  5. 02 May, 2020 1 commit
    • Fangrui Song's avatar
      [llvm-objcopy] -O binary: skip empty sections · d4d4c6bf
      Fangrui Song authored
      After SHF_ALLOC sections are ordered by LMA:
      
      * If initial sections are empty, GNU objcopy skips their contents while we
        emit leading zeros. (binary-paddr.test %t4)
      * If trailing sections are empty, GNU objcopy skips their contents while we
        emit trailing zeros. (binary-paddr.test %t5)
      
      This patch matches GNU objcopy's behavior. Linkers don't keep p_memsz
      PT_LOAD segments. Such empty sections would not have a containing
      PT_LOAD and `Section::ParentSegment` might be null if linkers fail to
      optimize the file offsets (lld D79254).
      
      In particular, without D79254, the arm Linux kernel's multi_v5_defconfig
      depends on this behavior: in `vmlinux`, an empty .text_itcm is mapped at
      a very high address (0xfffe0000) but the kernel does not expect
      `objcopy -O binary` to create a very large `arch/arm/boot/Image`
      (0xfffe0000-0xc0000000 ~= 1GiB). See https://bugs.llvm.org/show_bug.cgi?id=45632
      
      Reviewed By: jhenderson
      
      Differential Revision: https://reviews.llvm.org/D79229
      
      (cherry picked from commit ec786906)
      d4d4c6bf
  6. 30 Apr, 2020 5 commits
  7. 29 Apr, 2020 3 commits
  8. 28 Apr, 2020 1 commit
  9. 22 Apr, 2020 4 commits
  10. 17 Apr, 2020 1 commit
  11. 16 Apr, 2020 3 commits
    • Alexandre Ganea's avatar
      [CodeView] Align type records on 4-bytes when emitting PDBs · 6196695e
      Alexandre Ganea authored
      When emitting PDBs, the TypeStreamMerger class is used to merge .debug$T records from the input .OBJ files into the output .PDB stream.
      Records in .OBJs are not required to be aligned on 4-bytes, and "The Netwide Assembler 2.14" generates non-aligned records.
      
      When compiling with -DLLVM_ENABLE_ASSERTIONS=ON, an assert was triggered in MergingTypeTableBuilder when non-ghash merging was used.
      With ghash merging there was no assert.
      As a result, LLD could potentially generate a non-aligned TPI stream.
      
      We now align records on 4-bytes when record indices are remapped, in TypeStreamMerger::remapIndices().
      
      Differential Revision: https://reviews.llvm.org/D75081
      
      (cherry picked from commit a7325298)
      6196695e
    • Melanie Blower's avatar
      add release notes for ffp-model and ffp-exception-behavior · cc6e51a1
      Melanie Blower authored
      (cherry picked from commit c8dadac2)
      cc6e51a1
    • Simon Pilgrim's avatar
      [X86][SSE] combineX86ShufflesConstants - early out for zeroable vectors (PR45443) · ef7dbe6d
      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
      
      (cherry picked from commit e3b60597)
      ef7dbe6d