[PATCH] D68244: [InstCombine] don't assume 'inbounds' for bitcast pointer to GEP transform (PR43501)
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 3 04:28:16 PDT 2019
spatel added a comment.
In D68244#1692002 <https://reviews.llvm.org/D68244#1692002>, @jdoerfert wrote:
> You accidentally or intentionally did the right thing when it comes to `deref_or_null`.
> That is,
>
> define float @matching_scalar_smallest_deref_or_null(<4 x float>* dereferenceable_or_null(1) %p) {
> ; CHECK-LABEL: @matching_scalar_smallest_deref_or_null(
> ; CHECK-NEXT: [[BC:%.*]] = getelementptr inbounds <4 x float>, <4 x float>* [[P:%.*]], i64 0, i64 0
> ; CHECK-NEXT: [[R:%.*]] = load float, float* [[BC]], align 16
> ; CHECK-NEXT: ret float [[R]]
> ;
> %bc = bitcast <4 x float>* %p to float*
> %r = load float, float* %bc, align 16
> ret float %r
> }
>
>
> should also work fine.
Thanks, I'll add that test too. It was intentional to allow that possibility based on the previous comments, but admittedly, I'm not very familiar with 'inbounds' semantics/usage. The LangRef says:
"The only in bounds address for a null pointer in the default address-space is the null pointer itself."
So what does that mean for a null pointer *not* in the default address-space?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68244/new/
https://reviews.llvm.org/D68244
More information about the llvm-commits
mailing list