This is an archive of the discontinued LLVM Phabricator instance.

[Verifier] Remove invalid verifier check
ClosedPublic

Authored by skatkov on Mar 12 2020, 9:49 PM.

Details

Summary

According to LangRef for unordered atomic memory transfer intrinsics
"The first three arguments are the same as they are in the @llvm.memcpy intrinsic, with the added constraint that len is required to be a positive integer multiple of the element_size. If len is not a positive integer multiple of element_size, then the behaviour of the intrinsic is undefined."

So the len is not multiple of element size is just an undefined behavior and verifier should not complain about that
as undefined behavior is allowed in LLVM IR.

This change removes the verifier check for this condition

Diff Detail

Event Timeline

skatkov created this revision.Mar 12 2020, 9:49 PM
skatkov edited the summary of this revision. (Show Details)Mar 12 2020, 10:37 PM
reames accepted this revision.Mar 13 2020, 8:36 AM

LGTM

Also, you should add an instcombine which converts a UB length into an unreachable idiom. That would help simplify your example you shared privately. (Context: Switch case leading to dead code contains this construct.)

llvm/test/Verifier/element-wise-atomic-memory-intrinsics.ll
11–12

Please remove the check line, being overly specific to a message which no longer exists doesn't add any value.

37–38

Same

63–64

Same

This revision is now accepted and ready to land.Mar 13 2020, 8:36 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2020, 10:18 PM