[cse] Add support for struct_element_addr.

With this commit CSE reduces the standard library by ~1911 lines.

Swift SVN r10845
This commit is contained in:
Michael Gottesman
2013-12-05 05:35:00 +00:00
parent d6f3c5245e
commit a5d76c9abb
2 changed files with 20 additions and 12 deletions

View File

@@ -65,6 +65,7 @@ namespace {
case ValueKind::StringLiteralInst:
case ValueKind::StructInst:
case ValueKind::StructExtractInst:
case ValueKind::StructElementAddrInst:
return true;
default:
return false;
@@ -139,6 +140,13 @@ unsigned llvm::DenseMapInfo<SimpleValue>::getHashValue(SimpleValue Val) {
X->getField(),
X->getOperand());
}
case ValueKind::StructElementAddrInst: {
auto *X = cast<StructElementAddrInst>(Inst);
return llvm::hash_combine(unsigned(ValueKind::StructElementAddrInst),
X->getStructDecl(),
X->getField(),
X->getOperand());
}
default:
llvm_unreachable("Unhandled ValueKind.");
}