When requesting modref information between call site and memory location we will bailout with MRI_ModRef result if one of the nocapture, byval or operand bundle attributes aliases target location. However we can improve this decision by taking into account operand attributes. If for example we know that aliasing operand is readonly we should only infer MRI_Ref.
This is important for targets with heavy use of the deopt operand bundles since they imply readonly attribute for their pointers.
@davide, after this change llvm successfully compiles NewGVN/readattrs.ll test case. Overall this looks like a desired effect but I'm not completely certain. Can you take a look please?
Given we don't refine this (after suggested change described below) outside of the block we should sink this into the if block.