This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Remove IntrReadMem from memtime/memrealtime intrinsics
ClosedPublic

Authored by arsenm on Feb 25 2019, 9:38 AM.

Details

Reviewers
rampitec
Summary

EarlyCSE with MemorySSA was able to use this to merge multiple calls
with no intervening store.

Diff Detail

Event Timeline

arsenm created this revision.Feb 25 2019, 9:38 AM
rampitec requested changes to this revision.Feb 25 2019, 10:26 AM
  1. These intrinsics read internal state. If not IntrReadMem something needs to be added to model it.
  2. Patch does more than stated in the description with no justification.
lib/Target/AMDGPU/SMInstructions.td
160

It was zero before this patch.

803

It does not belong to the patch.

This revision now requires changes to proceed.Feb 25 2019, 10:26 AM
arsenm marked 2 inline comments as done.Feb 25 2019, 11:32 AM
  1. These intrinsics read internal state. If not IntrReadMem something needs to be added to model it.

IntrReadMem doesn't mean it reads memory, it means it only reads memory. Reading and writing memory is the default assumption. The negated behavior of the intrinsic memory attributes is part of why the tablegen inference is so broken

  1. Patch does more than stated in the description with no justification.
lib/Target/AMDGPU/SMInstructions.td
160

This is to defeat tablegen's completely broken inference of instruction flags based on intrinsic properties. This conflicts with the assumed mayStore since the intrinsic isn't IntrReadMem. The assumption the flags directly correspond to the intrinsic attributes is broken because the weird memory dependency is tracked here with hasSideEffects. It's even more broken because this was working with readcyclecounter already, since it isn't a target intrinsic.

803

This was part of trying to avoid not explicitly setting the mayStore flag, but that ultimately didn't work

arsenm updated this revision to Diff 188231.Feb 25 2019, 11:46 AM

Remove leftover attempt to defeat property inference

rampitec added inline comments.Feb 25 2019, 11:50 AM
lib/Target/AMDGPU/SMInstructions.td
160

At the very least it needs a comment explaining why is it '?'.

arsenm updated this revision to Diff 188233.Feb 25 2019, 11:57 AM

Add comment

This revision is now accepted and ready to land.Feb 25 2019, 11:59 AM
arsenm closed this revision.Feb 25 2019, 12:15 PM

r354814