[cfe-commits] r102238 - /cfe/trunk/lib/CodeGen/CGStmt.cpp

Chris Lattner clattner at apple.com
Sat Apr 24 21:57:50 PDT 2010


Doh, that's a recent regression.  Thanks Dan!

-Chris

On Apr 23, 2010, at 9:55 PM, Dan Gohman wrote:

> Author: djg
> Date: Fri Apr 23 23:55:02 2010
> New Revision: 102238
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=102238&view=rev
> Log:
> Fix a place in inline asm lowering which was creating a TruncInst with a
> pointer operand. This fixes an abort on
> MultiSource/Applications/ClamAV/libclamav_mbox.c.
> 
> Modified:
>    cfe/trunk/lib/CodeGen/CGStmt.cpp
> 
> Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=102238&r1=102237&r2=102238&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGStmt.cpp Fri Apr 23 23:55:02 2010
> @@ -1141,13 +1141,18 @@
>       // a pointer.
>       if (TruncTy->isFloatingPointTy())
>         Tmp = Builder.CreateFPTrunc(Tmp, TruncTy);
> -      else if (!isa<llvm::PointerType>(TruncTy))
> -        Tmp = Builder.CreateTrunc(Tmp, TruncTy);
> -      else {
> +      else if (TruncTy->isPointerTy() && Tmp->getType()->isIntegerTy()) {
>         uint64_t ResSize = CGM.getTargetData().getTypeSizeInBits(TruncTy);
>         Tmp = Builder.CreateTrunc(Tmp, llvm::IntegerType::get(VMContext,
>                                                             (unsigned)ResSize));
>         Tmp = Builder.CreateIntToPtr(Tmp, TruncTy);
> +      } else if (Tmp->getType()->isPointerTy() && TruncTy->isIntegerTy()) {
> +        uint64_t TmpSize =CGM.getTargetData().getTypeSizeInBits(Tmp->getType());
> +        Tmp = Builder.CreatePtrToInt(Tmp, llvm::IntegerType::get(VMContext,
> +                                                            (unsigned)TmpSize));
> +        Tmp = Builder.CreateTrunc(Tmp, TruncTy);
> +      } else if (TruncTy->isIntegerTy()) {
> +        Tmp = Builder.CreateTrunc(Tmp, TruncTy);
>       }
>     }
> 
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list