[llvm-commits] [llvm-gcc-4.2] r136345 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Duncan Sands
baldrick at free.fr
Thu Jul 28 02:13:43 PDT 2011
Author: baldrick
Date: Thu Jul 28 04:13:43 2011
New Revision: 136345
URL: http://llvm.org/viewvc/llvm-project?rev=136345&view=rev
Log:
Work around some fallout from the previous hack to work around
problems with the new type system. Will hopefully fix some
buildbots.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=136345&r1=136344&r2=136345&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Jul 28 04:13:43 2011
@@ -8699,14 +8699,15 @@
break;
}
- // Check that the type of the lvalue is indeed that of a pointer to the tree
- // node. Since LLVM has no void* type, don't insist that void* be converted
- // to a specific LLVM type.
- assert((VOID_TYPE_P(TREE_TYPE(exp)) ||
- LV->getType() == ConvertType(TREE_TYPE(exp))->getPointerTo()) &&
- "LValue of constant has wrong type!");
+ // Ensure that the lvalue has the expected type. It is simpler to do this
+ // once here rather than in every helper.
+ Type *Ty;
+ if (VOID_TYPE_P(TREE_TYPE(exp)))
+ Ty = Type::getInt8Ty(Context); // void* -> i8*.
+ else
+ Ty = ConvertType(TREE_TYPE(exp));
- return LV;
+ return TheFolder->CreateBitCast(LV, Ty->getPointerTo());
}
Constant *TreeConstantToLLVM::EmitLV_Decl(tree exp) {
More information about the llvm-commits
mailing list