Index: llvm/trunk/lib/Analysis/ConstantFolding.cpp =================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp @@ -1137,6 +1137,12 @@ return ConstantFoldCompareInstOperands(Predicate, C, Null, DL, TLI); } } + + if (CE0->getOpcode() == Instruction::AddrSpaceCast) { + Constant *C = CE0->getOperand(0); + Constant *Null = Constant::getNullValue(C->getType()); + return ConstantFoldCompareInstOperands(Predicate, C, Null, TD, TLI); + } } if (ConstantExpr *CE1 = dyn_cast(Ops1)) {