[cfe-commits] r66302 - in /cfe/trunk: lib/CodeGen/CGExprScalar.cpp test/CodeGenObjC/objc2-weak-compare.m
Fariborz Jahanian
fjahanian at apple.com
Fri Mar 6 15:05:56 PST 2009
Author: fjahanian
Date: Fri Mar 6 17:05:56 2009
New Revision: 66302
URL: http://llvm.org/viewvc/llvm-project?rev=66302&view=rev
Log:
Fixed a bug where generation of read-barriers caused
crash in ir-gen.
Added:
cfe/trunk/test/CodeGenObjC/objc2-weak-compare.m
Modified:
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=66302&r1=66301&r2=66302&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Fri Mar 6 17:05:56 2009
@@ -1015,6 +1015,9 @@
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");
}
Added: cfe/trunk/test/CodeGenObjC/objc2-weak-compare.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/objc2-weak-compare.m?rev=66302&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/objc2-weak-compare.m (added)
+++ cfe/trunk/test/CodeGenObjC/objc2-weak-compare.m Fri Mar 6 17:05:56 2009
@@ -0,0 +1,24 @@
+// RUN: clang -fnext-runtime -fobjc-gc -emit-llvm -o %t %s
+
+ at interface PBXTarget
+{
+
+PBXTarget * __weak _lastKnownTarget;
+PBXTarget * __weak _KnownTarget;
+PBXTarget * result;
+}
+- Meth;
+ at end
+
+ at implementation PBXTarget
+- Meth {
+ if (_lastKnownTarget != result)
+ foo();
+ if (result != _lastKnownTarget)
+ foo();
+
+ if (_lastKnownTarget != _KnownTarget)
+ foo();
+}
+
+ at end
More information about the cfe-commits
mailing list