[PATCH] D32423: Constant fold barriers of null and undef
Piotr Padlewski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 24 14:25:30 PDT 2017
Prazek added inline comments.
================
Comment at: lib/Analysis/ConstantFolding.cpp:1779-1783
+ if (isa<ConstantPointerNull>(Operands[0])) {
+ if (IntrinsicID == Intrinsic::invariant_group_barrier)
return Operands[0];
return nullptr;
}
----------------
majnemer wrote:
> Isn't this only valid if the address space is zero?
True, but can you pass pointer from another addrspace to invariant.group.barrier?
When I try
%X = addrspacecast i8* null to i8 addrspace(1)*
%b2 = call i8* @llvm.invariant.group.barrier(i8* %X)
I get
error: '%X' defined with type 'i8 addrspace(1)*'
I could add this line:
cast<PointerType>(Operands[0]->getType())->getAddressSpace() == 0
but I won't be able to test it in any way if I am not wrong.
https://reviews.llvm.org/D32423
More information about the llvm-commits
mailing list