[PATCH] D68244: [InstCombine] don't assume 'inbounds' for bitcast pointer to GEP transform (PR43501)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 08:02:13 PDT 2019


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:2348
+      uint64_t DerefBytes = Src->getPointerDereferenceableBytes(DL, CanBeNull);
+      unsigned EltBitWidth = DstElTy->getPrimitiveSizeInBits();
+      if (!CanBeNull && EltBitWidth && EltBitWidth % 8 == 0 &&
----------------
```
  /// Note that this may not reflect the size of memory allocated for an
  /// instance of the type or the number of bytes that are written when an
  /// instance of the type is stored to memory. The DataLayout class provides
  /// additional query functions to provide this information.
  ///
  unsigned getPrimitiveSizeInBits() const LLVM_READONLY;
```
We are sure this is what we want?


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

https://reviews.llvm.org/D68244





More information about the llvm-commits mailing list