[PATCH] D68328: Fix occurrences that size and range of pointers are assumed to be the same.

Joseph Faulls via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 06:26:10 PST 2019


Joe updated this revision to Diff 229081.
Joe edited the summary of this revision.
Joe added a comment.

Updated diff:

I am quite new to SCEV, but it really looks like it just shouldn't work on pointers sometimes. I've fixed it such that it works with custom dl on all tests, so hopefully this is okay.

Also fixed a few more places in which idx and ptr size are assumed to be the same.

Added tests which touch as many places I could manage where I changed ptr type to idx type. Many of the failures were caused due to the ptrtoint.

> I think you also missed
> 
>   @@ -9261,7 +9261,7 @@ unsigned SelectionDAG::InferPtrAlignment(SDValue Ptr) const {
>      const GlobalValue *GV;
>      int64_t GVOffset = 0;
>      if (TLI->isGAPlusOffset(Ptr.getNode(), GV, GVOffset)) {
>   -    unsigned IdxWidth = getDataLayout().getIndexTypeSizeInBits(GV->getType());
>   +    unsigned IdxWidth = getDataLayout().getPointerTypeSizeInBits(GV->getType());
>        KnownBits Known(IdxWidth);
>        llvm::computeKnownBits(GV, Known, getDataLayout());

Surely this should stay as IndexType?


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

https://reviews.llvm.org/D68328

Files:
  llvm/include/llvm/Analysis/PtrUseVisitor.h
  llvm/include/llvm/Analysis/Utils/Local.h
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/lib/Analysis/InlineCost.cpp
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/lib/Analysis/Loads.cpp
  llvm/lib/Analysis/MemoryBuiltins.cpp
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/Analysis/ScalarEvolutionExpander.cpp
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/lib/IR/DataLayout.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/test/Transforms/InstCombine/builtin-object-size-custom-dl.ll
  llvm/test/Transforms/InstCombine/gep-custom-dl.ll
  llvm/test/Transforms/InstCombine/icmp-custom-dl.ll
  llvm/test/Transforms/InstCombine/stdio-custom-dl.ll
  llvm/test/Transforms/PhaseOrdering/scev-custom-dl.ll
  llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68328.229081.patch
Type: text/x-patch
Size: 34002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191113/1266b3a2/attachment.bin>


More information about the llvm-commits mailing list