[PATCH] D68244: [InstCombine] don't assume 'inbounds' for bitcast pointer to GEP transform (PR43501)
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 2 10:15:44 PDT 2019
jdoerfert 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 &&
----------------
lebedev.ri wrote:
> lebedev.ri wrote:
> > ```
> > /// 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?
> Actually, what @jdoerfert was saying is that we don't care what the size of the type is.
> We only need to check that we have at least one dereferenceable byte.
That is what I should have said at least ;)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68244/new/
https://reviews.llvm.org/D68244
More information about the llvm-commits
mailing list