[PATCH] D26485: Add IntrInaccessibleMemOnly property for intrinsics

Andy Kaylor via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 9 16:53:31 PST 2016


andrew.w.kaylor created this revision.
andrew.w.kaylor added reviewers: hfinkel, nhaehnle.
andrew.w.kaylor added a subscriber: llvm-commits.
andrew.w.kaylor set the repository for this revision to rL LLVM.

This property corresponds directly to the inaccessiblememonly function attribute.

I intend to use this attribute with the experimental constrained FP intrinsics that I will be adding soon, but it seemed best to have these changes reviewed separately.

I considered adding this attribute to the @llvm.assume() intrinsic as Hal suggested in the comments on https://reviews.llvm.org/D26382, but that would have resulted in changes to aliasing behavior which is specifically tested for in test/Analysis/BasicAA/assume.ll and I am not familiar enough with that intrinsic to be comfortable judging whether or not that is acceptable.  Consequently, I have no direct test for this change set.  I am, of course, open to guidance.

A notable piece of code that I did not change is the InstAnalyzer::AnalyzeNode() function in utils/TableGen/CodeGenDAGPatterns.cpp.  That function contains the following code:

  if (const CodeGenIntrinsic *IntInfo = N->getIntrinsicInfo(CDP)) {
    // If this is an intrinsic, analyze it.
    if (IntInfo->ModRef & CodeGenIntrinsic::MR_Ref)
      mayLoad = true;// These may load memory.
  
    if (IntInfo->ModRef & CodeGenIntrinsic::MR_Mod)
      mayStore = true;// Intrinsics that can write to memory are 'mayStore'.
  
    if (IntInfo->ModRef >= CodeGenIntrinsic::ReadWriteMem)
      // ReadWriteMem intrinsics can have other strange effects.
      hasSideEffects = true;
  }

This code will not set the 'hasSideEffects' flag for intrinsics that use the IntrInaccessibleMemOnly property, but it currently does not set that flag for intrinsics that use the IntrArgMemOnly property.  This seems wrong to me in both cases, but I decided to defer to the existing logic over my own judgment pending review.


Repository:
  rL LLVM

https://reviews.llvm.org/D26485

Files:
  include/llvm/IR/Intrinsics.td
  utils/TableGen/CodeGenIntrinsics.h
  utils/TableGen/CodeGenTarget.cpp
  utils/TableGen/IntrinsicEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26485.77423.patch
Type: text/x-patch
Size: 4316 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161110/969fa9ef/attachment.bin>


More information about the llvm-commits mailing list