[PATCH] D20116: Add nosideeffects function attribute

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 13:23:08 PDT 2016


tstellarAMD added inline comments.

================
Comment at: docs/LangRef.rst:1404
@@ +1403,3 @@
+    This function attribute indicates that the function does not modify any
+    state that isn't accessbile from the IR (e.g. floating-point exception
+    registers).  Functions with the nosideeffects attribute can be safely
----------------
With my original definition, I was trying to match what we already have in the .td files for intrinsics.  I've updated the definition in this patch to be:

> nosideeffects tells the optimizer that the function does not modify any
> state that isn't accessible from the IR (e.g. floating-point exception
> registers).

I'm not sure if this is what you were thinking, but hopefully this gives us a better starting point for discussion.




================
Comment at: utils/TableGen/CodeGenIntrinsics.h:113
@@ +112,3 @@
+    return hasSideEffectsProperty ||
+      (ModRef >= CodeGenIntrinsic::ReadWriteMem && !hasNoSideEffectsProperty);
+  }
----------------
This a problem with the current definitions of TableGen's intrinsic properties.  Any intrinsic with IntrNoMem, IntrReadMem, IntrWriteMem, or IntrArgMemOnly is defined as having no side-effects.  The goal with this patch is to make it possible to have an intrinsic, like memcpy which only reads/writes arg memory, but may have other sideeffects. 


http://reviews.llvm.org/D20116





More information about the llvm-commits mailing list