[PATCH] D109676: [HardwareLoops] put +1 for loop count before zero extension

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 14 06:06:59 PDT 2021


shchenz added inline comments.


================
Comment at: llvm/lib/Analysis/TargetTransformInfo.cpp:191
+  bool WillNotOverflow =
+      (SE.getTypeSizeInBits(ExitCount->getType()) ==
+       CountType->getBitWidth()) ||
----------------
Legacy code also does not consider the overflow when `ExitCount->getType()` is same with `CountType`, since it works well on all platforms, so I think it should be OK to treat it as not overflow when `SE.getTypeSizeInBits(ExitCount->getType()) == CountType->getBitWidth()`.
```
  if (!ExitCount->getType()->isPointerTy() &&
      ExitCount->getType() != CountType)
    ExitCount = SE.getZeroExtendExpr(ExitCount, CountType);

  ExitCount = SE.getAddExpr(ExitCount, SE.getOne(CountType));
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109676



More information about the llvm-commits mailing list