This patch updates IPSCCP to drop argmemonly and
inaccessiblemem_or_argmemonly if it replaces a pointer argument.
Fixes PR46717.
| Paths 
 |  Differential  D84432  
[IPSCCP] Drop argmemonly after replacing pointer argument. ClosedPublic Authored by fhahn on Jul 23 2020, 9:31 AM. 
Details Summary This patch updates IPSCCP to drop argmemonly and Fixes PR46717. 
Diff Detail 
 Event TimelineComment Actions This doesn't "work" for define internal void @ptrarg.5(i64 %arg, i32 %val) argmemonly inaccessiblemem_or_argmemonly nounwind {
  %p = inttoptr i64 %arg to i32* 
  store i32 %val, i32* %p
  ret void
}Unsure if that is a problem in the real world but I wanted to mention it. Comment Actions 
 Is this valid (as in not UB)? For argmemonly, langref says ... loads and stores from objects pointed to by its pointer-typed arguments, with arbitrary offsets., but in the example we access an object not pointed to any pointer argument. BTW, I think it would be good to have something like an attribute verifier. Catching all violations is impossible, but at least some things could be checked :) Comment Actions 
 I think you're right. 
 100% Agreed, patches welcome ;) This revision is now accepted and ready to land.Jul 23 2020, 10:30 AM 
 fhahn marked an inline comment as done.Comment Actions Also drop callsite argmemonly/inaccessiblemem_or_argmemonly attributes 
 Closed by commit rG3c1476d26c76: [IPSCCP] Drop argmemonly after replacing pointer argument. (authored by fhahn).  ·  Explain WhyJul 25 2020, 4:08 AM This revision was automatically updated to reflect the committed changes. 
Revision Contents 
 
Diff 280665 llvm/lib/Transforms/Scalar/SCCP.cpp
 llvm/test/Transforms/SCCP/ipscp-drop-argmemonly.ll
 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Do we also need to modify the attributes on the callsites?