[all-commits] [llvm/llvm-project] 9b8bc5: [FlattenCFG] Fix an Imprecise Usage of AA (#128117)

Chengjun via All-commits all-commits at lists.llvm.org
Fri Apr 18 03:30:27 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9b8bc53a0bdc270f6d675ba7a2fe9ca9a855610d
      https://github.com/llvm/llvm-project/commit/9b8bc53a0bdc270f6d675ba7a2fe9ca9a855610d
  Author: Chengjun <chengjunp at Nvidia.com>
  Date:   2025-04-18 (Fri, 18 Apr 2025)

  Changed paths:
    M llvm/include/llvm/Analysis/AliasAnalysis.h
    M llvm/lib/Analysis/AliasAnalysis.cpp
    M llvm/lib/Transforms/Utils/FlattenCFG.cpp
    M llvm/test/Transforms/Util/flatten-cfg.ll
    M llvm/unittests/Analysis/AliasAnalysisTest.cpp

  Log Message:
  -----------
  [FlattenCFG] Fix an Imprecise Usage of AA (#128117)

In current `FlattenCFG`, using `isNoAlias` for two instructions is
imprecise. For example, when passing a store instruction and a load
instruction directly into `AA->isNoAlias`, it will always return
`NoAlias`. This happens because when checking the types of the two
Values, the store instruction (which has a `void` type) causes the
analysis to return `NoAlias`.

For instructions, we should use `getModRefInfo` instead of `isNoAlias`,
as aliasing is a concept of memory locations.

In this patch, `AAResults::getModRefInfo` is supported to take in two
instructions. It will check whether two instructions may access the same
memory location or not. And in `FlattenCFG`, we use this new helper
function to do the check instead of `isNoAlias`.

Unit tests and lit tests are also included to this patch.



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