[PATCH] D20116: Add nosideeffects function attribute
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 13 15:48:44 PDT 2016
eli.friedman added inline comments.
================
Comment at: docs/LangRef.rst:1405
@@ +1404,3 @@
+ state that isn't accessbile from the IR (e.g. floating-point exception
+ registers). Functions with the nosideeffects attribute can be safely
+ speculated.
----------------
The floating point status register is a weird example. The floating point status register is basically memory; it isn't actually addressable on most processors, but it behaves like a hidden global in every other way.
================
Comment at: utils/TableGen/CodeGenIntrinsics.h:113
@@ +112,3 @@
+ return hasSideEffectsProperty ||
+ (ModRef >= CodeGenIntrinsic::ReadWriteMem && !hasNoSideEffectsProperty);
+ }
----------------
tstellarAMD wrote:
> 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.
Oh, I see, this is an existing problem. :( I'd definitely like to see this resolved before you start changing optimizations to use this flag, but I guess you can change it in a followup.
Not that it helps memcpy in particular, but it might be worth considering some approach which allows one to say "this intrinsic has no side-effects if the pointer arguments are dereferenceable(n)".
http://reviews.llvm.org/D20116
More information about the llvm-commits
mailing list