[all-commits] [llvm/llvm-project] a30e50: [BasicAA] Do not decompose past casts with differe...

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Dec 13 03:59:20 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a30e50fcb3119cc1f84f0398d229a929f296188d
      https://github.com/llvm/llvm-project/commit/a30e50fcb3119cc1f84f0398d229a929f296188d
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2024-12-13 (Fri, 13 Dec 2024)

  Changed paths:
    M clang/test/CodeGen/SystemZ/zos-mixed-ptr-sizes-malloc.c
    M llvm/lib/Analysis/BasicAliasAnalysis.cpp
    M llvm/test/Analysis/BasicAA/smaller-index-size-overflow.ll

  Log Message:
  -----------
  [BasicAA] Do not decompose past casts with different index width (#119365)

BasicAA currently tries to support addrspacecasts that change the index
width by performing the decomposition in the maximum of all index widths
and then trying to fix this up with in-place sign extends to get correct
overflow behavior if the actual index width is smaller.

However, even in the case where we don't mix different index widths and
just have an index width that is smaller than the maximum, the behavior
is incorrect (see test), because we only perform the index width
adjustment during decomposition and not any of the later logic -- and we
don't do anything at all for variable offsets. I'm sure that the case
where we actually mix different index widths is even more broken than
that.

Fix this by not allowing decomposition through index width changes. If
the pointers have different index widths, fall back to a base object
comparison, ignoring the offsets.



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