[cfe-commits] r66012 - in /cfe/trunk: lib/CodeGen/CGDecl.cpp test/CodeGen/bool-convert.c

Eli Friedman eli.friedman at gmail.com
Tue Mar 3 20:25:14 PST 2009


Author: efriedma
Date: Tue Mar  3 22:25:14 2009
New Revision: 66012

URL: http://llvm.org/viewvc/llvm-project?rev=66012&view=rev
Log:
Continuation of PR3687: fix more places to use the right type for 
booleans.


Modified:
    cfe/trunk/lib/CodeGen/CGDecl.cpp
    cfe/trunk/test/CodeGen/bool-convert.c

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=66012&r1=66011&r2=66012&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Tue Mar  3 22:25:14 2009
@@ -232,7 +232,7 @@
   if (Ty->isConstantSizeType()) {
     if (!Target.useGlobalsForAutomaticVariables()) {
       // A normal fixed sized variable becomes an alloca in the entry block.
-      const llvm::Type *LTy = ConvertType(Ty);
+      const llvm::Type *LTy = ConvertTypeForMem(Ty);
       if (isByRef)
         LTy = BuildByRefType(Ty, getContext().getDeclAlignInBytes(&D));
       llvm::AllocaInst *Alloc =
@@ -278,7 +278,7 @@
     }
     
     // Get the element type.
-    const llvm::Type *LElemTy = ConvertType(Ty);    
+    const llvm::Type *LElemTy = ConvertTypeForMem(Ty);    
     const llvm::Type *LElemPtrTy =
       llvm::PointerType::get(LElemTy, D.getType().getAddressSpace());
 
@@ -318,7 +318,7 @@
     }
     if (!hasAggregateLLVMType(Init->getType())) {
       llvm::Value *V = EmitScalarExpr(Init);
-      Builder.CreateStore(V, Loc, D.getType().isVolatileQualified());
+      EmitStoreOfScalar(V, Loc, D.getType().isVolatileQualified());
     } else if (Init->getType()->isAnyComplexType()) {
       EmitComplexExprIntoAddr(Init, Loc, D.getType().isVolatileQualified());
     } else {
@@ -410,7 +410,7 @@
                                        llvm::GlobalValue::ExternalLinkage);
   } else {
     // A fixed sized single-value variable becomes an alloca in the entry block.
-    const llvm::Type *LTy = ConvertType(Ty);
+    const llvm::Type *LTy = ConvertTypeForMem(Ty);
     if (LTy->isSingleValueType()) {
       // TODO: Alignment
       std::string Name = D.getNameAsString();
@@ -418,7 +418,7 @@
       DeclPtr = CreateTempAlloca(LTy, Name.c_str());
       
       // Store the initial value into the alloca.
-      Builder.CreateStore(Arg, DeclPtr,Ty.isVolatileQualified());
+      EmitStoreOfScalar(Arg, DeclPtr, Ty.isVolatileQualified());
     } else {
       // Otherwise, if this is an aggregate, just use the input pointer.
       DeclPtr = Arg;

Modified: cfe/trunk/test/CodeGen/bool-convert.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/bool-convert.c?rev=66012&r1=66011&r2=66012&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/bool-convert.c (original)
+++ cfe/trunk/test/CodeGen/bool-convert.c Tue Mar  3 22:25:14 2009
@@ -4,4 +4,7 @@
 _Bool* test2;
 _Bool test3[10];
 _Bool (*test4)[];
-
+void f(int x) {
+  _Bool test5;
+  _Bool test6[x];
+}





More information about the cfe-commits mailing list