[all-commits] [llvm/llvm-project] cd119b: [gcov] Ignore blocks from another file

Koakuma via All-commits all-commits at lists.llvm.org
Mon Aug 21 22:51:29 PDT 2023

  Branch: refs/heads/release/17.x
  Home:   https://github.com/llvm/llvm-project
  Commit: cd119b354a934575aa0c8f84ac71a7be1f3def7f
  Author: Fangrui Song <i at maskray.me>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    A compiler-rt/test/profile/Posix/gcov-file-change.cpp
    M llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp

  Log Message:
  [gcov] Ignore blocks from another file

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 (1f34e282e8066281eb1447e21e44a2a2e9983e79).

(cherry picked from commit 406e81b79d26dae6838cc69d10a3e22635da09ef)

  Commit: 729272fb0e172ca9e9cab9091470b790a9a582e3
  Author: usama hameed <u_hameed at apple.com>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    M clang/lib/CodeGen/CodeGenFunction.cpp
    A clang/test/CodeGen/ubsan-function-attributed.c

  Log Message:
  [CodeGen][UBSan] Handle sugared QualTypes correctly in

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.


Differential Revision: https://reviews.llvm.org/D157445

(cherry picked from commit 9afc57dcb2e5cd36ca1ddf0fee3efa958bfd4c2a)

  Commit: f1f9dd395b538c84bbc86958cc7de62faa847c71
  Author: usama hameed <u_hameed at apple.com>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    M clang/test/CodeGen/ubsan-function-attributed.c

  Log Message:
  Add Requires x86 target to test due to failure in clang-armv8-quick

(cherry picked from commit bb5f64a6fc059fcf81b4b9ffe035f5063956ddd8)

  Commit: 53e5a6392ab4c37aff9438e96ba0f92d8321af51
  Author: Rainer Orth <ro at gcc.gnu.org>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    M clang/lib/Driver/ToolChains/Gnu.cpp
    M clang/unittests/Driver/ToolChainTest.cpp

  Log Message:
  [Driver] Select newest GCC installation on Solaris

As described in Issue #53709
<https://github.com/llvm/llvm-project/issues/53709>, since
`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

Differential Revision: https://reviews.llvm.org/D157275

(cherry picked from commit ae84ad15efd7ef7da95146e900ec72ceadf98058)

  Commit: efcacdb0f9c71bd631aba3ee896a1c54306ad0be
  Author: Rainer Orth <ro at gcc.gnu.org>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    M clang/unittests/Driver/ToolChainTest.cpp

  Log Message:
  [Driver][unittest] Unbreak ToolChainTest.cpp compilation with -Werror

D157275 broke some buildbots that run with -Werror:


Avoid this by using an overlong line rather than appeasing `clang-format`.

(cherry picked from commit 18252e6c8e2b1bb9901b5cca9e9a75edfeda2c4e)

  Commit: 7470d9a13088f97959f0e58519a72dbf537f1e59
  Author: Josh Stone <jistone at redhat.com>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    M llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
    A llvm/test/Analysis/CostModel/SystemZ/struct-cost-crash.ll

  Log Message:
  [SystemZ] Avoid type legalization on structs

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.


Reviewed By: uweigand

Differential Revision: https://reviews.llvm.org/D156379

(cherry picked from commit 85e4ee15d32ae0344755d11d4ca90a15a6e005cd)

  Commit: de0f8c265cef662a6acc6d09823d1d461a1bc8b9
  Author: XinWang10 <xin10.wang at intel.com>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/ToolChains/Arch/X86.cpp
    A clang/test/Driver/x86-no-gather-no-scatter.cpp
    M llvm/lib/Target/X86/X86.td
    M llvm/lib/Target/X86/X86TargetTransformInfo.cpp
    M llvm/lib/Target/X86/X86TargetTransformInfo.h
    A llvm/test/CodeGen/X86/x86-prefer-no-gather-no-scatter.ll

  Log Message:
  [X86]Support options -mno-gather -mno-scatter

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

  Commit: bceec8e801cfd359b6de86237e8cb7e2f8f8efa7
  Author: Eduard Zingerman <eddyz87 at gmail.com>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    M llvm/lib/Target/BPF/BPFMISimplifyPatchable.cpp
    A llvm/test/CodeGen/BPF/CORE/simplify-patchable-liveness-bug.ll

  Log Message:
  [BPF] Reset machine register kill mark in BPFMISimplifyPatchable

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

      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

    # 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 27026fe5633b546ed647efd99eccdfc598686535)

  Commit: daced851f0a659e4934d00fc7920e8c787379c7d
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaDecl.cpp
    M clang/test/C/C2x/n2927.c

  Log Message:
  No longer hang on typeof of a function type

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

  Commit: 7fdfe24a39c3ea8d268a1e48ec84fbc52cb10bc7
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst

  Log Message:
  Remove a merge conflict marker that was missed; NFC

  Commit: 6a8234396322ac6265f39ee439c71bc689b595e9
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst

  Log Message:
  Remove a release note that should not have snuck in

  Commit: 96d150b34f1a3e10e983ebe5be34c29a42a4b72c
  Author: Martin Storsjö <martin at martin.st>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    M llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp
    A llvm/test/CodeGen/AArch64/win64_vararg2.ll

  Log Message:
  [AArch64] [GlobalISel] Fix clobbered callee saved registers with win64 varargs

This fixes a regression since 1c10d5b175992a9d056a2d763a932e5652386fc1
/ https://reviews.llvm.org/D130903 by applying the same fix from
SelectionDAG from 8cb3667541a94c4fa11b06e19020f753414c1d03 /

This could possibly have been detected if the existing testcases
in win64_vararg.ll had been tested with GlobalISel too, but all
the IR snippets there fail to be translated with GlobalISel.

This adds a separate testcase based on real world LLVM IR (instead of
hand-reduced IR), which GlobalISel does translate happily - tested
with both SelectionDAG and GlobalISel.

Before this change, the stack object locations (visible in MIR
with "llc -print-after-all") didn't match with what the prologue
emitted by AArch64FrameLowering actually looked like, which caused
clobbered callee saved registers when function local stack objects
aliased the actual location of the callee saved registers.

This fixes https://github.com/llvm/llvm-project/issues/64740.

Differential Revision: https://reviews.llvm.org/D158272

(cherry picked from commit 955d7615bd7563cc78a5106215daf9e6e47ffb5e)

  Commit: 8890f0fafc61d192f8773221b55697d2b15a8cbe
  Author: wangpc <wangpengcheng.pp at bytedance.com>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    A llvm/test/CodeGen/RISCV/inline-asm-mem-constraint.ll
    M llvm/test/CodeGen/RISCV/inline-asm.ll

  Log Message:
  [RISCV][NFC] Move tests of inline asm memory constraints to separate file

We will need to check the output of medium code model.

Reviewed By: wangpc

Differential Revision: https://reviews.llvm.org/D157965

(cherry picked from commit a3b11ce78680ef39e4dfbc72085ae3e1814e3cba)

  Commit: 8918f6911b7cf73e3fd51d29f73782c1e147088c
  Author: wangpc <wangpengcheng.pp at bytedance.com>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
    M llvm/test/CodeGen/RISCV/inline-asm-mem-constraint.ll

  Log Message:
  [RISCV] Support global address as inline asm memory operand of `m`

In D146245, we have supported lowering inline asm `m` with offset
to `register+imm`, but we didn't handle the case that the offset
is the low part of global address.

This patch will emit `%lo(g)` when `g` is a global address.

Fixes #64656

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D157839

(cherry picked from commit dc60003ec8b2faf595b528a39f64b697a589da06)

  Commit: e1e460373aa8e59f25538818317b37b77f85a66f
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    A llvm/test/CodeGen/X86/pr64655.ll

  Log Message:
  [X86] Add test case for Issue #64655

(cherry picked from commit 2c090e9e67d306578dbeb966a34d9fb85b9f4121)

  Commit: b4bb394ac4c2680a153c80a7c11b3fb1405e914f
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/X86/pr64655.ll

  Log Message:
  [DAG] replaceStoreOfInsertLoad - don't fold if the inserted element is implicitly truncated

D152276 wasn't handling the case where the inserted element is implicitly truncated into the vector - resulting in a i1 element (implicitly truncated from i8) overwriting 8 bits instead of 1 bit.

This patch is intended to be merged into 17.x so I've just disallowed any vector element vs inserted element type mismatch - technically we could be more elegant and permit truncated stores (as long as the store is still byte sized), but the use cases for that are so limited I'd prefer to play it safe for now.

Candidate patch for #64655 17.x merge

Differential Revision: https://reviews.llvm.org/D158366

(cherry picked from commit ba818c4019c550e1a413e1563a05b241b508defd)

  Commit: 1991da9a837dcb083a2a960fbd6a3389da8cc6c1
  Author: Koakuma <koachan at protonmail.com>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    M llvm/lib/Target/Sparc/SparcInstrInfo.td
    M llvm/test/MC/Disassembler/Sparc/sparc-v9.txt
    M llvm/test/MC/Sparc/sparcv9-instructions.s

  Log Message:
  [SPARC][IAS] Add support for v9 DONE, RETRY, SAVED, & RESTORED

Add support for DONE, RETRY, SAVED, and RESTORED (v9 Section A.11 & Section A.47).

Those instructions are used for low-level interrupt handling and register window
management by OS kernels.

Reviewed By: barannikov88

Differential Revision: https://reviews.llvm.org/D144936

(cherry picked from commit bf499ec2b96c98633a8b2bc2113b19ffd437f647)

Compare: https://github.com/llvm/llvm-project/compare/4ec6595d6e5b...1991da9a837d

More information about the All-commits mailing list