[PATCH] D109746: [AA] Teach BasicAA to recognize basic GEP range information.

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 28 05:23:35 PDT 2021


courbet added a comment.

Thanks



================
Comment at: llvm/lib/Analysis/BasicAliasAnalysis.cpp:1231
+        if (!R.isFullSet() && !R.isEmptySet()) {
+          VarIndexRange = R.sextOrTrunc(Var.Scale.getBitWidth())
+                              .multiply(ConstantRange(Var.Scale));
----------------
nikic wrote:
> The Var represents a `zext(sext(V)) * Scale`, so this `sextOrTrunc` isn't right if ZExtBits is non-zero. We first need an (optional) sext and then an (optional) zext.
Done. I've also added a unit test with a zero extension that fails without this change.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109746/new/

https://reviews.llvm.org/D109746



More information about the llvm-commits mailing list