[all-commits] [llvm/llvm-project] 434353: [LAA] Rework overflow checking in getPtrStride [nfc]

Philip Reames via All-commits all-commits at lists.llvm.org
Mon May 1 10:22:00 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4343534a670f74e87841c0ca03d3189b72c04b1d
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2023-05-01 (Mon, 01 May 2023)

  Changed paths:
    M llvm/include/llvm/Analysis/LoopAccessAnalysis.h
    M llvm/lib/Analysis/LoopAccessAnalysis.cpp

  Log Message:
  [LAA] Rework overflow checking in getPtrStride [nfc]

The previous code structure and comments were exceedingly confusing.  I have multiple times looked at this code and suspected a bug.  This time, I decided to take the time to reflow the code and comment out why it is correct.

The only suspect (to me) case left is that an underaligned access with a unit stride (in terms of the access type) might miss the undefined null pointer when wrapping.  This is unlikely to be an issue for C/C++ code with real page sizes, so I'm not bothering to fully convince myself whether that case is correct or not.

More information about the All-commits mailing list