diff --git a/tools/llvm-upgrade/UpgradeParser.cpp b/tools/llvm-upgrade/UpgradeParser.cpp index a863a8981fd..96cae3b3e60 100644 --- a/tools/llvm-upgrade/UpgradeParser.cpp +++ b/tools/llvm-upgrade/UpgradeParser.cpp @@ -546,7 +546,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 diff --git a/tools/llvm-upgrade/UpgradeParser.cpp.cvs b/tools/llvm-upgrade/UpgradeParser.cpp.cvs index a863a8981fd..96cae3b3e60 100644 --- a/tools/llvm-upgrade/UpgradeParser.cpp.cvs +++ b/tools/llvm-upgrade/UpgradeParser.cpp.cvs @@ -546,7 +546,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 diff --git a/tools/llvm-upgrade/UpgradeParser.y.cvs b/tools/llvm-upgrade/UpgradeParser.y.cvs index 126a37542e6..5a4118d8d74 100644 --- a/tools/llvm-upgrade/UpgradeParser.y.cvs +++ b/tools/llvm-upgrade/UpgradeParser.y.cvs @@ -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