[PATCH] D20116: Add nosideeffects function attribute
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 15 23:40:10 PDT 2016
eli.friedman added a subscriber: eli.friedman.
Comment at: docs/LangRef.rst:1386
@@ -1384,1 +1385,3 @@
+ This function attribute indicates that the function has no side effects
+ and can be safely speculated.
This description needs to be more thorough... "can be safely speculated" is an extremely fuzzy description. Your commit message says that "divide-by-zero" counts as a side-effect, but that isn't listed here. Does an infinite loop count as a side-effect? Can a read from or write to a global? An argument? A volatile load?
Comment at: utils/TableGen/CodeGenIntrinsics.h:114
@@ +113,3 @@
+ return hasSideEffectsProperty ||
+ (ModRef >= CodeGenIntrinsic::ReadWriteMem && !hasNoSideEffectsProperty);
Saying that, for example, memcpy is nosideeffects seems very weird. "memcpy(0,0,8)" will crash. The same issue applies to basically any intrinsic that reads from or writes to its arguments.
More information about the llvm-commits