From bb9caa9241d3653185a0b510e4e02e2fa93e9f14 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 21 Jan 2013 13:04:33 +0000 Subject: Switch CodeMetrics itself over to use TTI to determine if an instruction is free. The whole CodeMetrics API should probably be reworked more, but this is enough to allow deleting the duplicate code there for computing whether an instruction is free. All of the passes using this have been updated to pull in TTI and hand it to the CodeMetrics stuff. Further, a dead CodeMetrics API (analyzeFunction) is nuked for lack of users. llvm-svn: 173036 --- llvm/lib/Analysis/TargetTransformInfo.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib/Analysis/TargetTransformInfo.cpp') diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp index 16ee6eb35c6..99720d4d034 100644 --- a/llvm/lib/Analysis/TargetTransformInfo.cpp +++ b/llvm/lib/Analysis/TargetTransformInfo.cpp @@ -258,6 +258,9 @@ struct NoTTI : ImmutablePass, TargetTransformInfo { } unsigned getUserCost(const User *U) const { + if (isa(U)) + return TCC_Free; // Model all PHI nodes as free. + if (const GEPOperator *GEP = dyn_cast(U)) // In the basic model we just assume that all-constant GEPs will be // folded into their uses via addressing modes. -- cgit v1.2.3