[all-commits] [llvm/llvm-project] d881ba: [BasicAA] Consider 'nneg' flag when comparing Cast...

Alex MacLean via All-commits all-commits at lists.llvm.org
Tue Jun 4 08:33:18 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d881bac6fa3b1d8d622d4fb651060cf7d6223080
      https://github.com/llvm/llvm-project/commit/d881bac6fa3b1d8d622d4fb651060cf7d6223080
  Author: Alex MacLean <amaclean at nvidia.com>
  Date:   2024-06-04 (Tue, 04 Jun 2024)

  Changed paths:
    M llvm/lib/Analysis/BasicAliasAnalysis.cpp
    A llvm/test/Analysis/BasicAA/zext-nneg.ll

  Log Message:
  -----------
  [BasicAA] Consider 'nneg' flag when comparing CastedValues (#94129)

Any of the `zext` bits in a `zext nneg` can be converted to `sext` but
when checking if casts are compatible `BasicAA` fails to take into
account `nneg`. This change adds tracking of `nneg` to the `CastedValue`
struct and ensures that `sext` and `zext` bits are treated as
interchangeable when either `CastedValue` has a `nneg`. When
distributing casted values in `GetLinearExpression` we conservatively
discard the `nneg` from the `CastedValue`, except in the case of `shl
nsw`, where we know the sign has not changed to negative.



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