[SIL] Add attributes to swift builtins, specifically, the readnone attribute.

Use the attribute when deciding if a call to a builtin can be eliminated as dead.

Swift SVN r7391
This commit is contained in:
Anna Zaks
2013-08-21 00:02:25 +00:00
parent 2f05d5c4df
commit 21ce68188d
10 changed files with 140 additions and 98 deletions

View File

@@ -15,6 +15,14 @@
using namespace swift;
static bool isSideEffectFree(BuiltinFunctionRefInst *FR) {
// First, check if we are dealing with a swift builtin.
const BuiltinInfo &Info = FR->getBuiltinInfo();
if (Info.ID != BuiltinValueKind::None) {
return Info.isReadNone();
}
// Second, specialcase llvm intrinsic.
// FIXME: This list might not be complete. Would be good to derive this
// info from llvm.
switch (FR->getIntrinsicInfo().ID) {