[PATCH] D68706: [InstCombine] don't assume 'inbounds' for bitcast deref or null pointer in non-default address space
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 9 09:50:31 PDT 2019
jdoerfert added a comment.
In D68706#1701551 <https://reviews.llvm.org/D68706#1701551>, @lebedev.ri wrote:
> You want `llvm::NullPointerIsDefined()`, which also checks for `"null-pointer-is-valid"` attribute.
`getPointerDereferenceableBytes` should do the above. The tests in the file show it works except there is one missing:
define float @matching_scalar_smallest_deref_addrspace(<4 x float> addrspace(4)* dereferenceable(1) %p) {
; CHECK-LABEL: @matching_scalar_smallest_deref_addrspace(
; CHECK-NEXT: [[BC:%.*]] = getelementptr inbounds <4 x float>, <4 x float> addrspace(4)* [[P:%.*]], i64 0, i64 0
; CHECK-NEXT: [[R:%.*]] = load float, float addrspace(4)* [[BC]], align 16
; CHECK-NEXT: ret float [[R]]
;
%bc = bitcast <4 x float> addrspace(4)* %p to float addrspace(4)*
%r = load float, float addrspace(4)* %bc, align 16
ret float %r
}
I think this is fine but I want to hear if people agree.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68706/new/
https://reviews.llvm.org/D68706
More information about the llvm-commits
mailing list