[all-commits] [llvm/llvm-project] ee3109: [update_llc_test_checks] Baseline test for D100027

Alexander Richardson via All-commits all-commits at lists.llvm.org
Tue Sep 28 09:58:00 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ee3109b044a2bb727b91df53f99483cfe7593a72
      https://github.com/llvm/llvm-project/commit/ee3109b044a2bb727b91df53f99483cfe7593a72
  Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
  Date:   2021-09-28 (Tue, 28 Sep 2021)

  Changed paths:
    A llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips64_eh.ll
    A llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips64_eh.ll.expected
    A llvm/test/tools/UpdateTestChecks/update_llc_test_checks/mips64_eh.test

  Log Message:
  -----------
  [update_llc_test_checks] Baseline test for D100027

Show that we fail to generate CHECK lines for MIPS64 functions with EH.

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


  Commit: 547e5e4ae613cf5ae3727abef84d5ac0334d9987
      https://github.com/llvm/llvm-project/commit/547e5e4ae613cf5ae3727abef84d5ac0334d9987
  Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
  Date:   2021-09-28 (Tue, 28 Sep 2021)

  Changed paths:
    M llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips64_eh.ll
    M llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips64_eh.ll.expected
    M llvm/utils/UpdateTestChecks/asm.py

  Log Message:
  -----------
  [update_llc_test_checks.py] Fix MIPS ASM regex for functions with EH

On MIPS, functions with exception handling code emits an additional
temporary label at the start of the function (due to UseAssignmentForEHBegin):

    _Z8do_catchv:                           # @_Z8do_catchv
    .Ltmp3:
    .set .Lfunc_begin0, .Ltmp3
    .cfi_startproc
    .cfi_personality 128, DW.ref.__gxx_personality_v0
    .cfi_lsda 0, .Lexception0
    .frame	$c11,48,$c17
    .mask 	0x00000000,0
    .fmask	0x00000000,0
    .set	noreorder
    .set	nomacro
    .set	noat
    # %bb.0:                                # %entry

The `[^:]*` regex was terminating the search after .Ltmp<N>: and therefore
not detecting functions with exception handling.

Reviewed By: atanasyan, MaskRay

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


  Commit: 3c51b9e270bac26fdec1b06ae8dd72960a2353a3
      https://github.com/llvm/llvm-project/commit/3c51b9e270bac26fdec1b06ae8dd72960a2353a3
  Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
  Date:   2021-09-28 (Tue, 28 Sep 2021)

  Changed paths:
    M llvm/lib/Analysis/Loads.cpp
    M llvm/unittests/Analysis/LoadsTest.cpp

  Log Message:
  -----------
  Fix incorrect GEP bitwidth in areNonOverlapSameBaseLoadAndStore()

When using a datalayout that has pointer index width != pointer size this
code triggers an assertion in Value::stripAndAccumulateConstantOffsets().
I encountered this this while compiling FreeBSD for CHERI-RISC-V.
Also update LoadsTest.cpp to use a DataLayout with index width != pointer
width to ensure this case is tested.

Reviewed By: nikic

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


  Commit: a28177035b16e8884107be686a805f82e8f35840
      https://github.com/llvm/llvm-project/commit/a28177035b16e8884107be686a805f82e8f35840
  Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
  Date:   2021-09-28 (Tue, 28 Sep 2021)

  Changed paths:
    M llvm/utils/UpdateTestChecks/common.py

  Log Message:
  -----------
  [UpdateTestChecks][NFC] Drop a python2 workaround


  Commit: d5631d49d070116ba2e23baad1ecf5f4cc08e6d1
      https://github.com/llvm/llvm-project/commit/d5631d49d070116ba2e23baad1ecf5f4cc08e6d1
  Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
  Date:   2021-09-28 (Tue, 28 Sep 2021)

  Changed paths:
    M clang/test/CodeGen/struct-init.c

  Log Message:
  -----------
  Drop REQUIRES: arm-registered-target from an IR-only test

This works just fine even if the Arm backend is not built.


  Commit: 90179f2323ac4ca0ed28ee94b9a61b565c1b61b6
      https://github.com/llvm/llvm-project/commit/90179f2323ac4ca0ed28ee94b9a61b565c1b61b6
  Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
  Date:   2021-09-28 (Tue, 28 Sep 2021)

  Changed paths:
    M clang/test/CodeGenCXX/member-function-pointer-calls.cpp

  Log Message:
  -----------
  [NFC] Add a comment to member-function-pointer-calls.cpp

Looking at this test I did not see why MinGW was using a different command
line until I looked at the git history. Add a comment explaining what this
RUN line is actually testing. Also add two more RUN lines to show that
indirectly passed member pointers don't inhibit the optimization.


  Commit: a18181931f991b04caea297e723db415756f09a0
      https://github.com/llvm/llvm-project/commit/a18181931f991b04caea297e723db415756f09a0
  Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
  Date:   2021-09-28 (Tue, 28 Sep 2021)

  Changed paths:
    M clang/test/CodeGen/2005-01-02-ConstantInits.c
    M clang/test/CodeGenCXX/2005-01-03-StaticInitializers.cpp
    M clang/test/CodeGenCXX/2008-05-07-CrazyOffsetOf.cpp

  Log Message:
  -----------
  [NFC][clang] Add a CHECK lines to tests checking offsetof-like expressions

I am looking at constant-folding changes that could affect these tests, so
check that it emits the expected global value instead of just checking
that it doesn't crash.


  Commit: fc0051011eece1448e8d7f5a478acde5b57e1887
      https://github.com/llvm/llvm-project/commit/fc0051011eece1448e8d7f5a478acde5b57e1887
  Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
  Date:   2021-09-28 (Tue, 28 Sep 2021)

  Changed paths:
    A llvm/test/Transforms/InstCombine/ptrtoint-nullgep.ll

  Log Message:
  -----------
  [InstCombine][ConstantFold] Baseline tests for ptrtoint(gep null, x)

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


  Commit: 9049a1c61e9a0cfa5ba41940f2d14597b9e0c431
      https://github.com/llvm/llvm-project/commit/9049a1c61e9a0cfa5ba41940f2d14597b9e0c431
  Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
  Date:   2021-09-28 (Tue, 28 Sep 2021)

  Changed paths:
    M llvm/lib/Analysis/ConstantFolding.cpp
    M llvm/test/Transforms/InstCombine/ptrtoint-nullgep.ll

  Log Message:
  -----------
  [ConstantFolding] Fold ptrtoint(gep i8 null, x) -> x

I was looking at some missed optimizations in CHERI-enabled targets and
noticed that we weren't removing vtable indirection for calls via known
pointers-to-members. The underlying reason for this is that we represent
pointers-to-function-members as {i8 addrspace(200)*, i64} and generate the
constant offsets using (gep i8 null, <index>). We use a constant GEP here
since inttoptr should be avoided for CHERI capabilities. The pointer-to-member
call uses ptrtoint to extract the index, and due to this missing fold we can't
infer the actual value loaded from the vtable.
This is the initial constant folding change for this pattern, I will add
an InstCombine fold as a follow-up.

We could fold all inbounds GEP to null (and therefore the ptrtoint to
zero) since zero is the only valid offset for an inbounds GEP. If the
offset is not zero, that GEP is poison and therefore returning 0 is valid
(https://alive2.llvm.org/ce/z/Gzb5iH). However, Clang currently generates
inbounds GEPs on NULL for hand-written offsetof() expressions, so this
could lead to miscompilations.

Reviewed By: lebedev.ri

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


  Commit: ebb3dc08339cd9d5c4204f0a60742514909d5acd
      https://github.com/llvm/llvm-project/commit/ebb3dc08339cd9d5c4204f0a60742514909d5acd
  Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
  Date:   2021-09-28 (Tue, 28 Sep 2021)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
    M llvm/test/Transforms/InstCombine/ptrtoint-nullgep.ll

  Log Message:
  -----------
  [InstCombine] Fold ptrtoint(gep i8 null, x) -> x

This commit is the InstCombine follow-up to the previous constant-folding
change that enables noticeable optimizations for CHERI-enabled targets.

Reviewed By: nikic

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


Compare: https://github.com/llvm/llvm-project/compare/a7d084a18de7...ebb3dc08339c


More information about the All-commits mailing list