summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen/PerfMonitor.cpp
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2017-04-03 15:23:08 +0000
committerTobias Grosser <tobias@grosser.es>2017-04-03 15:23:08 +0000
commit637be04b77537d693923961821c05096a6c75c40 (patch)
treec32e9fbe0dacfe7e7215c0465af070940e33cadf /polly/lib/CodeGen/PerfMonitor.cpp
parent65371af2e18348e1ea45516c1ace17de0c6e46c6 (diff)
downloadbcm5719-llvm-637be04b77537d693923961821c05096a6c75c40.tar.gz
bcm5719-llvm-637be04b77537d693923961821c05096a6c75c40.zip
[PerfMonitor] Use Intrinsics::getDeclaration
Instead of creating the declaration ourselves, we obtain it directly from the LLVM intrinsic definitions. This addresses a post-review comment for r299359. Suggested-by: Hongzing Zheng <etherzhhb@gmail.com> llvm-svn: 299360
Diffstat (limited to 'polly/lib/CodeGen/PerfMonitor.cpp')
-rw-r--r--polly/lib/CodeGen/PerfMonitor.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/polly/lib/CodeGen/PerfMonitor.cpp b/polly/lib/CodeGen/PerfMonitor.cpp
index cc0e277a015..3defeef737d 100644
--- a/polly/lib/CodeGen/PerfMonitor.cpp
+++ b/polly/lib/CodeGen/PerfMonitor.cpp
@@ -12,6 +12,7 @@
#include "polly/CodeGen/PerfMonitor.h"
#include "polly/CodeGen/RuntimeDebugBuilder.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/IR/Intrinsics.h"
using namespace llvm;
using namespace polly;
@@ -56,17 +57,7 @@ void PerfMonitor::addToGlobalConstructors(Function *Fn) {
}
Function *PerfMonitor::getRDTSCP() {
- const char *Name = "llvm.x86.rdtscp";
- Function *F = M->getFunction(Name);
-
- if (!F) {
- GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
- FunctionType *Ty = FunctionType::get(Builder.getInt64Ty(),
- {Builder.getInt8PtrTy()}, false);
- F = Function::Create(Ty, Linkage, Name, M);
- }
-
- return F;
+ return Intrinsic::getDeclaration(M, Intrinsic::x86_rdtscp);
}
PerfMonitor::PerfMonitor(Module *M) : M(M), Builder(M->getContext()) {
OpenPOWER on IntegriCloud