diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-12-09 16:56:55 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-12-09 16:56:55 +0000 |
commit | a00c5a6d87915bc256f13f779d9c8e5d710d5737 (patch) | |
tree | 5c478692cc0d0c680dd9924f0a7c55f4a9145164 | |
parent | ee2c7b08c5ca12c7ea062a3c976f950a57b80b23 (diff) |
When upgrading cast to bool to a setne, generate icmp ne instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32399 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/llvm-upgrade/UpgradeParser.y | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/llvm-upgrade/UpgradeParser.y b/tools/llvm-upgrade/UpgradeParser.y index f53369d603..126a37542e 100644 --- a/tools/llvm-upgrade/UpgradeParser.y +++ b/tools/llvm-upgrade/UpgradeParser.y @@ -194,10 +194,16 @@ static std::string getCastUpgrade( // the original intent by replace the cast with a setne const char* comparator = SrcTy.isPointer() ? ", null" : (SrcTy.isFloatingPoint() ? ", 0.0" : ", 0"); - if (isConst) - Result = "setne (" + Source + comparator + ")"; - else - Result = "setne " + Source + comparator; +#if UPGRADE_SETCOND_OPS + const char* compareOp = SrcTy.isFloatingPoint() ? "setne " : "icmp ne "; +#else + const char* compareOp = "setne"; +#endif + if (isConst) { + Result = "(" + Source + comparator + ")"; + Result = compareOp + Result; + } else + Result = compareOp + Source + comparator; return Result; // skip cast processing below } ResolveType(SrcTy); |