[all-commits] [llvm/llvm-project] fbc0c3: [BasicAA] Handle known bits as ranges

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Oct 27 05:41:53 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fbc0c308d599fe3300ab6516650b65b41979446d
      https://github.com/llvm/llvm-project/commit/fbc0c308d599fe3300ab6516650b65b41979446d
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-10-27 (Wed, 27 Oct 2021)

  Changed paths:
    M llvm/lib/Analysis/BasicAliasAnalysis.cpp
    M llvm/test/Analysis/BasicAA/assume-index-positive.ll

  Log Message:
  -----------
  [BasicAA] Handle known bits as ranges

BasicAA currently tries to determine that the offset is positive by
checking whether all variable indices are positive based on known
bits, multiplied by a positive scale. However, this is incorrect
if the scale multiplication might overflow. In the modified test
case the original value is positive, but may be negative after a
left shift.

Fix this by converting known bits into a constant range and reusing
the range-based logic, which handles overflow correctly.

Differential Revision: https://reviews.llvm.org/D112611




More information about the All-commits mailing list