This patch updates IPSCCP to drop argmemonly and
inaccessiblemem_or_argmemonly if it replaces a pointer argument.
Fixes PR46717.
|  Differential  D84432  
[IPSCCP] Drop argmemonly after replacing pointer argument. Authored by fhahn on Jul 23 2020, 9:31 AM. 
Details 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 ;) 
 Comment Actions Also drop callsite argmemonly/inaccessiblemem_or_argmemonly attributes 
 | ||||||||||||
Do we also need to modify the attributes on the callsites?