summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Northover <t.p.northover@gmail.com>2019-12-18 12:26:02 +0000
committerTim Northover <t.p.northover@gmail.com>2019-12-19 21:50:47 +0000
commit85cb560b8a421d950ccea593b4ee0569249dc136 (patch)
tree3027e34bcba5ef9ec659443b350956cd8d9c3e95
parent50c3bd9e71254d623ed4f0b449d5620f4e965bfe (diff)
downloadbcm5719-llvm-85cb560b8a421d950ccea593b4ee0569249dc136.tar.gz
bcm5719-llvm-85cb560b8a421d950ccea593b4ee0569249dc136.zip
ConstrainedFP: use API compatible with opaque pointers.
This just updates an IRBuilder interface to take Functions instead of Values so the type can be derived, and fixes some callsites in Clang to call the updated API.
-rw-r--r--clang/lib/CodeGen/CGBuiltin.cpp12
-rw-r--r--llvm/include/llvm/IR/IRBuilder.h10
2 files changed, 9 insertions, 13 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 37aca09bff5..3b35fc23a1b 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -368,10 +368,10 @@ static Value *emitUnaryMaybeConstrainedFPBuiltin(CodeGenFunction &CGF,
llvm::Value *Src0 = CGF.EmitScalarExpr(E->getArg(0));
if (CGF.Builder.getIsFPConstrained()) {
- Value *F = CGF.CGM.getIntrinsic(ConstrainedIntrinsicID, Src0->getType());
+ Function *F = CGF.CGM.getIntrinsic(ConstrainedIntrinsicID, Src0->getType());
return CGF.Builder.CreateConstrainedFPCall(F, { Src0 });
} else {
- Value *F = CGF.CGM.getIntrinsic(IntrinsicID, Src0->getType());
+ Function *F = CGF.CGM.getIntrinsic(IntrinsicID, Src0->getType());
return CGF.Builder.CreateCall(F, Src0);
}
}
@@ -385,10 +385,10 @@ static Value *emitBinaryMaybeConstrainedFPBuiltin(CodeGenFunction &CGF,
llvm::Value *Src1 = CGF.EmitScalarExpr(E->getArg(1));
if (CGF.Builder.getIsFPConstrained()) {
- Value *F = CGF.CGM.getIntrinsic(ConstrainedIntrinsicID, Src0->getType());
+ Function *F = CGF.CGM.getIntrinsic(ConstrainedIntrinsicID, Src0->getType());
return CGF.Builder.CreateConstrainedFPCall(F, { Src0, Src1 });
} else {
- Value *F = CGF.CGM.getIntrinsic(IntrinsicID, Src0->getType());
+ Function *F = CGF.CGM.getIntrinsic(IntrinsicID, Src0->getType());
return CGF.Builder.CreateCall(F, { Src0, Src1 });
}
}
@@ -403,10 +403,10 @@ static Value *emitTernaryMaybeConstrainedFPBuiltin(CodeGenFunction &CGF,
llvm::Value *Src2 = CGF.EmitScalarExpr(E->getArg(2));
if (CGF.Builder.getIsFPConstrained()) {
- Value *F = CGF.CGM.getIntrinsic(ConstrainedIntrinsicID, Src0->getType());
+ Function *F = CGF.CGM.getIntrinsic(ConstrainedIntrinsicID, Src0->getType());
return CGF.Builder.CreateConstrainedFPCall(F, { Src0, Src1, Src2 });
} else {
- Value *F = CGF.CGM.getIntrinsic(IntrinsicID, Src0->getType());
+ Function *F = CGF.CGM.getIntrinsic(IntrinsicID, Src0->getType());
return CGF.Builder.CreateCall(F, { Src0, Src1, Src2 });
}
}
diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h
index 5d5f12d2c7c..1abdf2242b5 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -2421,18 +2421,16 @@ public:
Args, OpBundles, Name, FPMathTag);
}
- // Deprecated [opaque pointer types]
CallInst *CreateConstrainedFPCall(
- Value *Callee, ArrayRef<Value *> Args, const Twine &Name = "",
+ Function *Callee, ArrayRef<Value *> Args, const Twine &Name = "",
Optional<fp::RoundingMode> Rounding = None,
Optional<fp::ExceptionBehavior> Except = None) {
llvm::SmallVector<Value *, 6> UseArgs;
for (auto *OneArg : Args)
UseArgs.push_back(OneArg);
- Function *F = cast<Function>(Callee);
bool HasRoundingMD = false;
- switch (F->getIntrinsicID()) {
+ switch (Callee->getIntrinsicID()) {
default:
break;
#define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) \
@@ -2445,9 +2443,7 @@ public:
UseArgs.push_back(getConstrainedFPRounding(Rounding));
UseArgs.push_back(getConstrainedFPExcept(Except));
- CallInst *C = CreateCall(
- cast<FunctionType>(Callee->getType()->getPointerElementType()), Callee,
- UseArgs, Name);
+ CallInst *C = CreateCall(Callee, UseArgs, Name);
setConstrainedFPCallAttr(C);
return C;
}
OpenPOWER on IntegriCloud