changeset 757:2c730d530c98

Special case DtoCastInt for bool.
author Christian Kamm <kamm incasoftware de>
date Mon, 10 Nov 2008 20:55:24 +0100
parents a58784e0f035
children f04dde6e882c
files gen/llvmhelpers.cpp
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gen/llvmhelpers.cpp	Sat Nov 08 22:29:19 2008 +0100
+++ b/gen/llvmhelpers.cpp	Mon Nov 10 20:55:24 2008 +0100
@@ -570,7 +570,7 @@
     }
 
     if (to->isintegral()) {
-        if (fromsz < tosz) {
+        if (fromsz < tosz || from->ty == Tbool) {
             if (Logger::enabled())
                 Logger::cout() << "cast to: " << *tolltype << '\n';
             if (from->isunsigned() || from->ty == Tbool) {
@@ -579,7 +579,7 @@
                 rval = new llvm::SExtInst(rval, tolltype, "tmp", gIR->scopebb());
             }
         }
-        else if (fromsz > tosz) {
+        else if (fromsz > tosz || to->ty == Tbool) {
             rval = new llvm::TruncInst(rval, tolltype, "tmp", gIR->scopebb());
         }
         else {