1. Aug 22, 2023
    • Aaron Ballman's avatar
      7fdfe24a
    • Aaron Ballman's avatar
      No longer hang on typeof of a function type · daced851
      Aaron Ballman authored
      We were calling `isFunctionProtoType()` on a `ParsedType` rather than
      creating a valid semantic type first and calling the function on that.
      The call to `isFunctionProtoType()` would eventually call
      `getUnqualifiedDesugaredType()`, which loops indefinitely until we get
      a desugared type and a `ParsedType` will never finish desugaring.
      
      Fixes https://github.com/llvm/llvm-project/issues/64713
      daced851
    • Eduard Zingerman's avatar
      [BPF] Reset machine register kill mark in BPFMISimplifyPatchable · bceec8e8
      Eduard Zingerman authored
      When LLVM is build with `LLVM_ENABLE_EXPENSIVE_CHECKS=ON` option
      the following C code snippet:
      
          struct t {
            unsigned long a;
          } __attribute__((preserve_access_index));
      
          void foo(volatile struct t *t, volatile unsigned long *p) {
            *p = t->a;
            *p = t->a;
          }
      
      Causes an assertion:
      
          $ clang -g -O2 -c --target=bpf -mcpu=v2 t2.c -o /dev/null
      
          # After BPF PreEmit SimplifyPatchable
          # Machine code for function foo: IsSSA, TracksLiveness
          Function Live Ins: $r1 in %0, $r2 in %1
      
          bb.0.entry:
            liveins: $r1, $r2
            DBG_VALUE $r1, $noreg, !"t", !DIExpression()
            DBG_VALUE $r2, $noreg, !"p", !DIExpression()
            %1:gpr = COPY $r2
            DBG_VALUE %1:gpr, $noreg, !"p", !DIExpression()
            %0:gpr = COPY $r1
            DBG_VALUE %0:gpr, $noreg, !"t", !DIExpression()
            %2:gpr = LD_imm64 @"llvm.t:0:0$0:0"
            %4:gpr = ADD_rr %0:gpr(tied-def 0), killed %2:gpr
            %5:gpr = CORE_LD 344, %0:gpr, @"llvm.t:0:0$0:0"
            STD killed %5:gpr, %1:gpr, 0
            %7:gpr = ADD_rr %0:gpr(tied-def 0), killed %2:gpr
            %8:gpr = CORE_LD 344, %0:gpr, @"llvm.t:0:0$0:0"
            STD killed %8:gpr, %1:gpr, 0
            RET
      
          # End machine code for function foo.
      
          *** Bad machine code: Using a killed virtual register ***
          - function:    foo
          - basic block: %bb.0 entry (0x6210000e6690)
          - instruction: %7:gpr = ADD_rr %0:gpr(tied-def 0), killed %2:gpr
          - operand 2:   killed %2:gpr
      
      This happens because of the way
      BPFMISimplifyPatchable::processDstReg() updates second operand of the
      `ADD_rr` instruction. Code before `BPFMISimplifyPatchable`:
      
          .-> %2:gpr = LD_imm64 @"llvm.t:0:0$0:0"
          |
          |`----------------.
          |   %3:gpr = LDD %2:gpr, 0
          |   %4:gpr = ADD_rr %0:gpr(tied-def 0), killed %3:gpr <--- (1)
          |   %5:gpr = LDD killed %4:gpr, 0       ^^^^^^^^^^^^^
          |   STD killed %5:gpr, %1:gpr, 0        this is updated
           `----------------.
              %6:gpr = LDD %2:gpr, 0
              %7:gpr = ADD_rr %0:gpr(tied-def 0), killed %6:gpr <--- (2)
              %8:gpr = LDD killed %7:gpr, 0       ^^^^^^^^^^^^^
              STD killed %8:gpr, %1:gpr, 0        this is updated
      
      Instructions (1) and (2) would be updated to:
      
          ADD_rr %0:gpr(tied-def 0), killed %2:gpr
      
      The `killed` mark is inherited from machine operands `killed %3:gpr`
      and `killed %6:gpr` which are updated inplace by `processDstReg()`.
      
      This commit updates `processDstReg()` reset kill marks for updated
      machine operands to keep liveness information conservatively correct.
      
      Differential Revision: https://reviews.llvm.org/D157805
      
      (cherry picked from commit 27026fe5)
      bceec8e8
    • XinWang10's avatar
      [X86]Support options -mno-gather -mno-scatter · de0f8c26
      XinWang10 authored
      Gather instructions could lead to security issues, details please refer to https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/technical-documentation/gather-data-sampling.html.
      This supported options -mno-gather and -mno-scatter, which could avoid generating gather/scatter instructions in backend except using intrinsics or inline asms.
      
      Reviewed By: pengfei
      
      Differential Revision: https://reviews.llvm.org/D157680
      de0f8c26
    • Josh Stone's avatar
      [SystemZ] Avoid type legalization on structs · 7470d9a1
      Josh Stone authored
      In SystemZTTIImpl::getMemoryOpCost, the call to getNumberOfParts will
      run type legalization, which can't handle structs. So before that, we
      check for an unknown value type and forward to BaseT, just like many
      other targets do in this situation.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=2224885
      
      Reviewed By: uweigand
      
      Differential Revision: https://reviews.llvm.org/D156379
      
      (cherry picked from commit 85e4ee15)
      7470d9a1
    • Rainer Orth's avatar
      [Driver][unittest] Unbreak ToolChainTest.cpp compilation with -Werror · efcacdb0
      Rainer Orth authored
      D157275 broke some buildbots that run with -Werror:
      
      	https://lab.llvm.org/buildbot#builders/36/builds/36604
      	https://lab.llvm.org/buildbot#builders/57/builds/29201
      
      Avoid this by using an overlong line rather than appeasing `clang-format`.
      
      (cherry picked from commit 18252e6c)
      efcacdb0
    • Rainer Orth's avatar
      [Driver] Select newest GCC installation on Solaris · 53e5a639
      Rainer Orth authored
      As described in Issue #53709
      <https://github.com/llvm/llvm-project/issues/53709>, since
      28d58d8f
      <https://reviews.llvm.org/rG28d58d8fe2094af6902dee7b4d68ec30a3e9d737>
      `clang` doesn't find the latest of several parallel GCC installations on
      Solaris, but only the first in directory order, which is pretty random.
      
      This patch sorts GCC installations in reverse version order so the latest
      is picked.
      
      Tested on `sparcv9-sun-solaris2.11`, `amd64-pc-solaris2.11`, and
      `x86_64-pc-linux-gnu`.
      
      Differential Revision: https://reviews.llvm.org/D157275
      
      (cherry picked from commit ae84ad15)
      53e5a639
    • usama hameed's avatar
      Add Requires x86 target to test due to failure in clang-armv8-quick · f1f9dd39
      usama hameed authored
      bot
      
      (cherry picked from commit bb5f64a6)
      f1f9dd39
    • usama hameed's avatar
      [CodeGen][UBSan] Handle sugared QualTypes correctly in · 729272fb
      usama hameed authored
      getUBSanFunctionTypeHash.
      
      getUBSanFunctionTypeHash checks if a Type is a FunctionNoPrototype
      by calling isa<FunctionNoProtoType>(). This does not work correctly when
      the Type is wrapped in a sugar type such as an AttributedType. This
      patch fixes this by using isFunctionNoProtoType() function which removes
      sugar and returns the expected result.
      
      The added test is a sanity check that the compiler no longer crashes
      during compilation. It also compares the hash with and without the
      function attribute for both FunctionNoProtoType and FunctionProtoType.
      The hash remains the same for FunctionNoProtoType even with the addition
      of an attribute.
      
      rdar://113144087
      
      Differential Revision: https://reviews.llvm.org/D157445
      
      (cherry picked from commit 9afc57dc)
      729272fb
    • Fangrui Song's avatar
      [gcov] Ignore blocks from another file · cd119b35
      Fangrui Song authored
      Constructs such as inline variables, #line, and #include can create
      lexical blocks with a different filename.
      GCOVProfiling and llvm-cov gcov currently don't handle such cases (see
      GCOVLines::writeOut and GCOVFile::readGCNO) and would incorrectly
      attribute the line number to the current file.
      
      For now, ignore such blocks. Missing line execution counts is better
      than wrong ones.
      
      ---
      
      As a workaround that Apple targets don't use -mconstructor-aliases yet,
      allow line execution count 4 on the A::A line (1f34e282).
      
      (cherry picked from commit 406e81b7)
      cd119b35
  2. Aug 21, 2023
  3. Aug 18, 2023
  4. Aug 17, 2023
  5. Aug 16, 2023