[PATCH] D129561: [RS4GC] Fix over-restrictive assert in atomic memcpy/move handling

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 18 06:22:10 PDT 2022


mkazantsev added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp:1705
       auto GetBaseAndOffset = [&](Value *Derived) {
-        assert(PointerToBase.count(Derived));
         unsigned AddressSpace = Derived->getType()->getPointerAddressSpace();
----------------
mkazantsev wrote:
> mkazantsev wrote:
> > apilipenko wrote:
> > > I suggest handling the undef case explicitly. Just return undef if the input is undef. 
> > Same goes for poison I guess.
> It's a no-go. Aside from undef and poison, here can be things like
> ```
> i32 addrspace(1)* bitcast (i8 addrspace(1)* getelementptr inbounds (i8, i8 addrspace(1)* null, i64 16) to i32 addrspace(1)*)
> ```
> etc. So the expression can be arbitrarily complex.
General idea is that undef may not be the immediate value, but a part of any other expression. Therefore, there is no way to guarantee it's not involved somewhere. The assert is just over-conservative w.r.t. this situation.


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

https://reviews.llvm.org/D129561



More information about the llvm-commits mailing list