[TargetTransformInfo][NFCI] Add TargetTransformInfo::isZExtFree.
authorSanjoy Das <sanjoy@playingwithpointers.com>
Mon, 27 Jul 2015 23:27:43 +0000 (23:27 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Mon, 27 Jul 2015 23:27:43 +0000 (23:27 +0000)
Summary:
This function is not used in this change but will be used in a
subsequent change.

Reviewers: mcrosier, chandlerc

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D9180

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243347 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/TargetTransformInfo.h
include/llvm/Analysis/TargetTransformInfoImpl.h
include/llvm/CodeGen/BasicTTIImpl.h
lib/Analysis/TargetTransformInfo.cpp

index eb6fa9da369528a0458781fcba1f8dd57d3c8dcd..a85174a108106437be3ce9b829617c154b7d29ed 100644 (file)
@@ -331,6 +331,11 @@ public:
   /// by referencing its sub-register AX.
   bool isTruncateFree(Type *Ty1, Type *Ty2) const;
 
+  /// \brief Return true if it's free to zero extend a value of type Ty1 to type
+  /// Ty2. e.g. on x86-64, all instructions that define 32-bit values implicit
+  /// zero-extend the result out to 64 bits.
+  bool isZExtFree(Type *Ty1, Type *Ty2) const;
+
   /// \brief Return true if it is profitable to hoist instruction in the
   /// then/else to before if.
   bool isProfitableToHoist(Instruction *I) const;
@@ -571,6 +576,7 @@ public:
                                    int64_t BaseOffset, bool HasBaseReg,
                                    int64_t Scale, unsigned AddrSpace) = 0;
   virtual bool isTruncateFree(Type *Ty1, Type *Ty2) = 0;
+  virtual bool isZExtFree(Type *Ty1, Type *Ty2) = 0;
   virtual bool isProfitableToHoist(Instruction *I) = 0;
   virtual bool isTypeLegal(Type *Ty) = 0;
   virtual unsigned getJumpBufAlignment() = 0;
@@ -704,6 +710,9 @@ public:
   bool isTruncateFree(Type *Ty1, Type *Ty2) override {
     return Impl.isTruncateFree(Ty1, Ty2);
   }
+  bool isZExtFree(Type *Ty1, Type *Ty2) override {
+    return Impl.isZExtFree(Ty1, Ty2);
+  }
   bool isProfitableToHoist(Instruction *I) override {
     return Impl.isProfitableToHoist(I);
   }
index 505126acc0a4fb1ce267348ab9fdcd789416ff80..2abe0a58b840749162895b81f219fe6916f23f77 100644 (file)
@@ -216,6 +216,8 @@ public:
 
   bool isTruncateFree(Type *Ty1, Type *Ty2) { return false; }
 
+  bool isZExtFree(Type *Ty1, Type *Ty2) { return false; }
+
   bool isProfitableToHoist(Instruction *I) { return true; }
 
   bool isTypeLegal(Type *Ty) { return false; }
index 9ba25169fda627ea5bd0df339b2313b0c753faa3..796a78c16ac1ea3a5251582232f53fa46f6d6b4f 100644 (file)
@@ -143,6 +143,10 @@ public:
     return getTLI()->isTruncateFree(Ty1, Ty2);
   }
 
+  bool isZExtFree(Type *Ty1, Type *Ty2) const {
+    return getTLI()->isZExtFree(Ty1, Ty2);
+  }
+
   bool isProfitableToHoist(Instruction *I) {
     return getTLI()->isProfitableToHoist(I);
   }
index 7d1c3fbef68a8972ce6eab6d5be1c5ef8bda75ff..b426b2f121ca20321627e6d39f01eb7b97204d19 100644 (file)
@@ -129,6 +129,10 @@ bool TargetTransformInfo::isTruncateFree(Type *Ty1, Type *Ty2) const {
   return TTIImpl->isTruncateFree(Ty1, Ty2);
 }
 
+bool TargetTransformInfo::isZExtFree(Type *Ty1, Type *Ty2) const {
+  return TTIImpl->isZExtFree(Ty1, Ty2);
+}
+
 bool TargetTransformInfo::isProfitableToHoist(Instruction *I) const {
   return TTIImpl->isProfitableToHoist(I);
 }