Fixed a bug where generation of read-barriers caused

crash in ir-gen.

llvm-svn: 66302
This commit is contained in:
Fariborz Jahanian 2009-03-06 23:05:56 +00:00
parent a74a29771f
commit f5d0613ce9
2 changed files with 27 additions and 0 deletions

View File

@ -1015,6 +1015,9 @@ 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");
}

View File

@ -0,0 +1,24 @@
// RUN: clang -fnext-runtime -fobjc-gc -emit-llvm -o %t %s
@interface PBXTarget
{
PBXTarget * __weak _lastKnownTarget;
PBXTarget * __weak _KnownTarget;
PBXTarget * result;
}
- Meth;
@end
@implementation PBXTarget
- Meth {
if (_lastKnownTarget != result)
foo();
if (result != _lastKnownTarget)
foo();
if (_lastKnownTarget != _KnownTarget)
foo();
}
@end