[all-commits] [llvm/llvm-project] cf8d24: [msan] Reduces overhead of #113200, by 10% (#113201)

Vitaly Buka via All-commits all-commits at lists.llvm.org
Thu Oct 24 20:47:10 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cf8d24531e0464d32031e5490cf2772f47645674
      https://github.com/llvm/llvm-project/commit/cf8d24531e0464d32031e5490cf2772f47645674
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2024-10-24 (Thu, 24 Oct 2024)

  Changed paths:
    M llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
    M llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll
    M llvm/test/Instrumentation/MemorySanitizer/pr32842.ll

  Log Message:
  -----------
  [msan] Reduces overhead of #113200, by 10% (#113201)

CTMark #113200 size overhead was 5.3%, now it's 4.7%.

The patch affects only signed integers.

https://alive2.llvm.org/ce/z/Lv5hyi

* The patch replaces code which extracted sign bit,
maximized/minimized it, then packed it back, with
simple sign bit flip. The another way to think about
transformation is as a subtraction of MIN_SINT from
A/B. Then we map MIN_SINT to 0, 0 to -MIN_SINT, and
MAX_SINT to MAX_UINT.

* Then to maximize/minimize A/B we don't need
to extract sign bit, we can apply shadow the
same way as to other bits.

* After sign bit flip, we had to switch to unsigned
version of the predicates.

* After change above  getHighestPossibleValue/getLowestPossibleValue
became very similar, so we can combine into a single function.

* Because the function does sign bit flip and
requires unsigned predicates used for returned values,
there is no point in keeping it as a member of class,
to hide, we switch to function local lambda.



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