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 | 87644df5bc61ae8f0a75db5cd566155ec1eeb946 (patch) | |
| tree | 5bc1cf8a2eaefa5653f4fa041706e26e1d9b4093 | |
| parent | b558b57e752f60eb7d4b8fbad6167778f41a7493 (diff) | |
| download | bcm5719-llvm-87644df5bc61ae8f0a75db5cd566155ec1eeb946.tar.gz bcm5719-llvm-87644df5bc61ae8f0a75db5cd566155ec1eeb946.zip | |
When upgrading cast to bool to a setne, generate icmp ne instead.
llvm-svn: 32399
| -rw-r--r-- | llvm/tools/llvm-upgrade/UpgradeParser.y | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/tools/llvm-upgrade/UpgradeParser.y b/llvm/tools/llvm-upgrade/UpgradeParser.y index f53369d6031..126a37542e6 100644 --- a/llvm/tools/llvm-upgrade/UpgradeParser.y +++ b/llvm/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); |

