Devirtualize calls on temporaries. A().f() for example.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83882 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index 0744b79..ed7ee42 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -206,8 +206,14 @@
// This is a record decl. We know the type and can devirtualize it.
return VD->getType()->isRecordType();
}
+
+ return false;
}
+ // We can always devirtualize calls on temporaries.
+ if (isa<CXXTemporaryObjectExpr>(Base))
+ return true;
+
// We can't devirtualize the call.
return false;
}