[all-commits] [llvm/llvm-project] 778732: [ubsan] Improve lowering of @llvm.allow.ubsan.chec...

Vitaly Buka via All-commits all-commits at lists.llvm.org
Sat Dec 7 16:13:19 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7787328dd64c750c7acf30b86b31f0d7166c8f27
      https://github.com/llvm/llvm-project/commit/7787328dd64c750c7acf30b86b31f0d7166c8f27
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2024-12-07 (Sat, 07 Dec 2024)

  Changed paths:
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/test/CodeGen/allow-ubsan-check-inline.c

  Log Message:
  -----------
  [ubsan] Improve lowering of @llvm.allow.ubsan.check (#119013)

This fix the case, when single hot inlined callsite, prevent
checks for all other. This helps to reduce number of removed checks up
to 50% (deppedes on `cutoff-hot` value) .

`ScalarOptimizerLateEPCallback` was happening during
CGSCC walk, after each inlining, but this is effectively
after inlining.

Example, order in comments:

```
static void overflow() {
  // 1. Inline get/set if possible
  // 2. Simplify
  // 3. LowerAllowCheckPass
  set(get() + get());
}

void test() {
  // 4. Inline
  // 5. Nothing for LowerAllowCheckPass
  overflow();
}
```

With this patch it will look like:
```
static void overflow() {
  // 1. Inline get/set if possible
  // 2. Simplify
  set(get() + get());
}

void test() {
  // 3. Inline
  // 4. Simplify
  overflow();
}

// Later, after inliner CGSCC walk complete:
// 5. LowerAllowCheckPass for `overflow`
// 6. LowerAllowCheckPass for `test`
```



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