[PATCH] D90610: [Inline] Fix in handling of ptrtoint in InlineCost

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 07:19:24 PST 2020


uabelho added inline comments.


================
Comment at: llvm/lib/Analysis/InlineCost.cpp:1104
   unsigned AS = I.getOperand(0)->getType()->getPointerAddressSpace();
   if (IntegerSize >= DL.getPointerSizeInBits(AS)) {
     std::pair<Value *, APInt> BaseAndOffset =
----------------
I suppose the simplest fix would just be to change the >= to == here, so we only save stuff in ConstantOffsetPtrs when the sizes match exactly?


================
Comment at: llvm/lib/Analysis/InlineCost.cpp:1124
+      else {
+        APInt OffsetWithCorrectSize = BaseAndOffset.second.sext(IntegerSize);
+        std::pair<Value *, APInt> BaseAndOffsetWithCorrectSize =
----------------
I don't know if sext is what we want to do here, of it that may lead to problems?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90610



More information about the llvm-commits mailing list