Add method to query for 'NoAlias' attribute on call/invoke instructions.
[oota-llvm.git] / include / llvm / Support / TargetFolder.h
index e6b501c88e6c4cd82f03c7f5c91c74a58cebb984..a02db2fe66681e7c0efa092dd0a7525ed83758fe 100644 (file)
@@ -132,36 +132,32 @@ public:
 
   Constant *CreateGetElementPtr(Constant *C,
                                 ArrayRef<Constant *> IdxList) const {
-    return Fold(ConstantExpr::getGetElementPtr(C, IdxList.data(),
-                                               IdxList.size()));
+    return Fold(ConstantExpr::getGetElementPtr(C, IdxList));
   }
   Constant *CreateGetElementPtr(Constant *C, Constant *Idx) const {
     // This form of the function only exists to avoid ambiguous overload
     // warnings about whether to convert Idx to ArrayRef<Constant *> or
     // ArrayRef<Value *>.
-    return Fold(ConstantExpr::getGetElementPtr(C, &Idx, 1));
+    return Fold(ConstantExpr::getGetElementPtr(C, Idx));
   }
   Constant *CreateGetElementPtr(Constant *C,
                                 ArrayRef<Value *> IdxList) const {
-    return Fold(ConstantExpr::getGetElementPtr(C, IdxList.data(),
-                                               IdxList.size()));
+    return Fold(ConstantExpr::getGetElementPtr(C, IdxList));
   }
 
   Constant *CreateInBoundsGetElementPtr(Constant *C,
                                         ArrayRef<Constant *> IdxList) const {
-    return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList.data(),
-                                                       IdxList.size()));
+    return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList));
   }
   Constant *CreateInBoundsGetElementPtr(Constant *C, Constant *Idx) const {
     // This form of the function only exists to avoid ambiguous overload
     // warnings about whether to convert Idx to ArrayRef<Constant *> or
     // ArrayRef<Value *>.
-    return Fold(ConstantExpr::getInBoundsGetElementPtr(C, &Idx, 1));
+    return Fold(ConstantExpr::getInBoundsGetElementPtr(C, Idx));
   }
   Constant *CreateInBoundsGetElementPtr(Constant *C,
                                         ArrayRef<Value *> IdxList) const {
-    return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList.data(),
-                                                       IdxList.size()));
+    return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList));
   }
 
   //===--------------------------------------------------------------------===//
@@ -181,7 +177,14 @@ public:
     return Fold(ConstantExpr::getIntegerCast(C, DestTy, isSigned));
   }
   Constant *CreatePointerCast(Constant *C, Type *DestTy) const {
-    return ConstantExpr::getPointerCast(C, DestTy);
+    if (C->getType() == DestTy)
+      return C; // avoid calling Fold
+    return Fold(ConstantExpr::getPointerCast(C, DestTy));
+  }
+  Constant *CreateFPCast(Constant *C, Type *DestTy) const {
+    if (C->getType() == DestTy)
+      return C; // avoid calling Fold
+    return Fold(ConstantExpr::getFPCast(C, DestTy));
   }
   Constant *CreateBitCast(Constant *C, Type *DestTy) const {
     return CreateCast(Instruction::BitCast, C, DestTy);