[all-commits] [llvm/llvm-project] 9e95c4: [DSE] Fix non-determinism due to address reuse (#8...

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Apr 12 21:27:01 PDT 2024


  Branch: refs/heads/users/MaskRay/spr/sema-mark-aliasifunc-targets-used-and-consider-mangled-names
  Home:   https://github.com/llvm/llvm-project
  Commit: 9e95c4947d31670ddd3abad1051eda06729c96b3
      https://github.com/llvm/llvm-project/commit/9e95c4947d31670ddd3abad1051eda06729c96b3
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2024-04-13 (Sat, 13 Apr 2024)

  Changed paths:
    M llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp

  Log Message:
  -----------
  [DSE] Fix non-determinism due to address reuse (#84943)

The malloc->calloc fold creates a new MemoryAccess, which may end of at
the same address as a previously deleted access inside SkipStores.

To the most part, this is not a problem, because SkipStores is normally
only used together with MemDefs. Neither the old malloc access nor the
new calloc access will be part of MemDefs, so there is no problem here.

However, SkipStores is also used in one more place: In the main DSE
loop, ToCheck entries are checked against it. Fix this by not using
SkipStores here, and instead using a separate set to track deletions
inside this loop. This way it is not affected by the calloc optimization
that happens outside it.

This is all pretty ugly, but I haven't found another good way to fix it.
Suggestions welcome.

No test case as I don't have a reliable DSE-only test-case for this.

Fixes https://github.com/llvm/llvm-project/issues/84458.


  Commit: f172bfcdc229ed6f3e8a0298dab3713fb763ff28
      https://github.com/llvm/llvm-project/commit/f172bfcdc229ed6f3e8a0298dab3713fb763ff28
  Author: Volodymyr Sapsai <vsapsai at apple.com>
  Date:   2024-04-12 (Fri, 12 Apr 2024)

  Changed paths:
    M llvm/include/llvm/ADT/StringMap.h

  Log Message:
  -----------
  [unused-includes][ADT] Don't include DJB.h as it's not used. NFC. (#88211)

StringMap uses xxHash instead of DJB.


  Commit: f22c30063ddcb7f8e8c4fb0496f515be7f9408b8
      https://github.com/llvm/llvm-project/commit/f22c30063ddcb7f8e8c4fb0496f515be7f9408b8
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-04-12 (Fri, 12 Apr 2024)

  Changed paths:
    M clang/test/Sema/alias-unused.cpp

  Log Message:
  -----------
  [test] alias-unused.cpp: set triple to Linux

Otherwise the test would fail on Darwin and other platforms that use
Itanium ABI but do not support alias/ifunc.


  Commit: fb2b9889bcaf2340e73188ebb5d568603289b234
      https://github.com/llvm/llvm-project/commit/fb2b9889bcaf2340e73188ebb5d568603289b234
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-04-12 (Fri, 12 Apr 2024)

  Changed paths:
    M clang/test/Sema/alias-unused.cpp
    M llvm/include/llvm/ADT/StringMap.h
    M llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp

  Log Message:
  -----------
  use x86_64-linux since Darwin doesn't support ifunc

Created using spr 1.3.5-bogner


Compare: https://github.com/llvm/llvm-project/compare/1e8d74ccf417...fb2b9889bcaf

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list