[llvm-commits] [gcc-plugin] r81351 - /gcc-plugin/trunk/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Wed Sep 9 09:55:24 PDT 2009


Author: baldrick
Date: Wed Sep  9 11:55:24 2009
New Revision: 81351

URL: http://llvm.org/viewvc/llvm-project?rev=81351&view=rev
Log:
An ssa name may require a trivial type conversion (useless_type_conversion_p)
in order to have the same type as the expression result.  For non-aggregate
values this means converting one pointer type into another, so a bitcast is
enough.

Modified:
    gcc-plugin/trunk/llvm-convert.cpp

Modified: gcc-plugin/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=81351&r1=81350&r2=81351&view=diff

==============================================================================
--- gcc-plugin/trunk/llvm-convert.cpp (original)
+++ gcc-plugin/trunk/llvm-convert.cpp Wed Sep  9 11:55:24 2009
@@ -2929,7 +2929,8 @@
   // If this is the definition of an ssa name, record it in the SSANames map.
   if (TREE_CODE(lhs) == SSA_NAME) {
     assert(SSANames.find(lhs) == SSANames.end() && "Multiply defined SSA name!");
-    return SSANames[lhs] = Emit(rhs, 0);
+    return SSANames[lhs] = Builder.CreateBitCast(Emit(rhs, 0),
+                                                 ConvertType(TREE_TYPE(exp)));
   } else if (canEmitRegisterVariable(lhs)) {
     // If this is a store to a register variable, EmitLV can't handle the dest
     // (there is no l-value of a register variable).  Emit an inline asm node





More information about the llvm-commits mailing list