Rather than having special rules like "intrinsics cannot
throw exceptions", just mark intrinsics with the nounwind
attribute. Likewise, mark intrinsics as readnone/readonly
and get rid of special aliasing logic (which didn't use
anything more than this anyway).
llvm-svn: 44544
diff --git a/llvm/lib/VMCore/AutoUpgrade.cpp b/llvm/lib/VMCore/AutoUpgrade.cpp
index 40c431c..311941f 100644
--- a/llvm/lib/VMCore/AutoUpgrade.cpp
+++ b/llvm/lib/VMCore/AutoUpgrade.cpp
@@ -20,7 +20,7 @@
using namespace llvm;
-Function* llvm::UpgradeIntrinsicFunction(Function *F) {
+static Function* UpgradeIntrinsicFunction1(Function *F) {
assert(F && "Illegal to upgrade a non-existent Function.");
// Get the Function's name.
@@ -119,6 +119,17 @@
return 0;
}
+Function* llvm::UpgradeIntrinsicFunction(Function *F) {
+ Function *Upgraded = UpgradeIntrinsicFunction1(F);
+
+ // Upgrade intrinsic attributes. This does not change the function.
+ if (Upgraded)
+ F = Upgraded;
+ if (unsigned id = F->getIntrinsicID(true))
+ F->setParamAttrs(Intrinsic::getParamAttrs((Intrinsic::ID)id));
+ return Upgraded;
+}
+
// UpgradeIntrinsicCall - Upgrade a call to an old intrinsic to be a call the
// upgraded intrinsic. All argument and return casting must be provided in
// order to seamlessly integrate with existing context.