[all-commits] [llvm/llvm-project] a353e2: [LAA] Don't require Stride == 1/-1 for inbounds po...

Florian Hahn via All-commits all-commits at lists.llvm.org
Tue Nov 5 13:46:17 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a353e258ba495be58263d6cc6e382e6dde298361
      https://github.com/llvm/llvm-project/commit/a353e258ba495be58263d6cc6e382e6dde298361
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2024-11-05 (Tue, 05 Nov 2024)

  Changed paths:
    M llvm/lib/Analysis/LoopAccessAnalysis.cpp
    M llvm/test/Analysis/LoopAccessAnalysis/depend_diff_types.ll
    M llvm/test/Analysis/LoopAccessAnalysis/evaluate-at-symbolic-max-backedge-taken-count-may-wrap.ll
    M llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll
    M llvm/test/Transforms/LoopDistribute/scev-inserted-runtime-check.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/sve-gather-scatter-cost.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/sve-gather-scatter.ll
    M llvm/test/Transforms/LoopVectorize/X86/pr54634.ll
    M llvm/test/Transforms/LoopVectorize/interleaved-accesses-2.ll
    M llvm/test/Transforms/LoopVectorize/interleaved-accesses-3.ll
    M llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll

  Log Message:
  -----------
  [LAA] Don't require Stride == 1/-1 for inbounds pointer AddRecs nowrap. (#113126)

If we have a pointer AddRec, the maximum increment is
2^(pointer-index-wdith - 1) - 1. This means that if incrementing the
AddRec wraps, the distance between the previously accessed location and
the wrapped location is > 2^(pointer-index-wdith - 1), i.e. if the GEP
for the AddRec is inbounds, this would be poison due to the object being
larger than half the pointer index type space. The poison would be
immediate UB when the memory access gets executed..

Similar reasoning can be applied for decrements.

PR: https://github.com/llvm/llvm-project/pull/113126



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