diff --git a/tools/llvm-upgrade/UpgradeParser.y b/tools/llvm-upgrade/UpgradeParser.y index 126a37542e6..5a4118d8d74 100644 --- a/tools/llvm-upgrade/UpgradeParser.y +++ b/tools/llvm-upgrade/UpgradeParser.y @@ -188,7 +188,7 @@ static std::string getCastUpgrade( SrcTy.destroy(); SrcTy.newTy = new std::string("ulong"); SrcTy.oldTy = ULongTy; - } else if (DstTy.oldTy == BoolTy) { + } else if (DstTy.oldTy == BoolTy && SrcTy.oldTy != BoolTy) { // cast ptr %x to bool was previously defined as setne ptr %x, null // The ptrtoint semantic is to truncate, not compare so we must retain // the original intent by replace the cast with a setne