From 563fb903fab15972e2d9c66b0ae046a94be86a71 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Sun, 13 Jan 2013 11:26:44 +0000 Subject: [PATCH] CGBuiltin.cpp: Fix abuse of ArrayRef in EmitOverflowIntrinsic(). In ArrayRef(X), X should not be temporary value. It could be rewritten more redundantly; llvm::Type *XTy = X->getType(); ArrayRef Ty(XTy); llvm::Value *Callee = CGF.CGM.getIntrinsic(IntrinsicID, Ty); Since it is safe if both XTy and Ty are temporary value in one statement, it could be shorten; llvm::Value *Callee = CGF.CGM.getIntrinsic(IntrinsicID, ArrayRef(X->getType())); ArrayRef has an implicit constructor to create uni-entry of T; llvm::Value *Callee = CGF.CGM.getIntrinsic(IntrinsicID, X->getType()); MSVC-generated clang.exe crashed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172352 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGBuiltin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index 9badeaf613..1a53f62440 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -187,8 +187,7 @@ static llvm::Value *EmitOverflowIntrinsic(CodeGenFunction &CGF, "Arguments must be the same type. (Did you forget to make sure both " "arguments have the same integer width?)"); - ArrayRef Type(X->getType()); - llvm::Value *Callee = CGF.CGM.getIntrinsic(IntrinsicID, Type); + llvm::Value *Callee = CGF.CGM.getIntrinsic(IntrinsicID, X->getType()); llvm::Value *Tmp = CGF.Builder.CreateCall2(Callee, X, Y); Carry = CGF.Builder.CreateExtractValue(Tmp, 1); return CGF.Builder.CreateExtractValue(Tmp, 0); -- 2.40.0