diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-03-07 03:57:15 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-03-07 03:57:15 +0000 |
commit | a374b68b5ad5278842b4b7c27d6f9562762dc7ce (patch) | |
tree | 7f27d9fd40e681c18330d61f384d18d0c9de8555 /clang/lib/CodeGen | |
parent | 6f7d9f8774c5888fe25f55ced435510b73cffd0e (diff) | |
download | bcm5719-llvm-a374b68b5ad5278842b4b7c27d6f9562762dc7ce.tar.gz bcm5719-llvm-a374b68b5ad5278842b4b7c27d6f9562762dc7ce.zip |
Back out the patch in r66302, and re-fix it properly. We assume for
performance that the type of the returned llvm::Value for an expression
matches the converted type of the clang::Expr; mismatches will cause all
sorts of errors and silent miscompilations.
llvm-svn: 66321
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 9afe450c582..8cd353408fd 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -1015,9 +1015,6 @@ Value *ScalarExprEmitter::EmitCompare(const BinaryOperator *E,unsigned UICmpOpc, LHS, RHS, "cmp"); } else { // Unsigned integers and pointers. - // Casting becomes necessary with -fobjc-gc as one or the other my turn - // into an 'id' type due to generation of read barriers. - RHS = Builder.CreateBitCast(RHS, LHS->getType()); Result = Builder.CreateICmp((llvm::ICmpInst::Predicate)UICmpOpc, LHS, RHS, "cmp"); } diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 9b7bfc6ce72..11836adf566 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -2177,9 +2177,12 @@ void CGObjCMac::EmitThrowStmt(CodeGen::CodeGenFunction &CGF, llvm::Value * CGObjCMac::EmitObjCWeakRead(CodeGen::CodeGenFunction &CGF, llvm::Value *AddrWeakObj) { + const llvm::Type* DestTy = + cast<llvm::PointerType>(AddrWeakObj->getType())->getElementType(); AddrWeakObj = CGF.Builder.CreateBitCast(AddrWeakObj, ObjCTypes.PtrObjectPtrTy); llvm::Value *read_weak = CGF.Builder.CreateCall(ObjCTypes.GcReadWeakFn, AddrWeakObj, "weakread"); + read_weak = CGF.Builder.CreateBitCast(read_weak, DestTy); return read_weak; } @@ -4766,9 +4769,12 @@ llvm::Value * CGObjCNonFragileABIMac::EmitObjCWeakRead( CodeGen::CodeGenFunction &CGF, llvm::Value *AddrWeakObj) { + const llvm::Type* DestTy = + cast<llvm::PointerType>(AddrWeakObj->getType())->getElementType(); AddrWeakObj = CGF.Builder.CreateBitCast(AddrWeakObj, ObjCTypes.PtrObjectPtrTy); llvm::Value *read_weak = CGF.Builder.CreateCall(ObjCTypes.GcReadWeakFn, AddrWeakObj, "weakread"); + read_weak = CGF.Builder.CreateBitCast(read_weak, DestTy); return read_weak; } |