[llvm-commits] [gcc-plugin] r82531 - /gcc-plugin/trunk/llvm-convert.cpp
Duncan Sands
baldrick at free.fr
Tue Sep 22 00:08:44 PDT 2009
Author: baldrick
Date: Tue Sep 22 02:08:44 2009
New Revision: 82531
URL: http://llvm.org/viewvc/llvm-project?rev=82531&view=rev
Log:
The CALL_EXPR -> GIMPLE_CALL rework broke the case of a
function returning a struct, when the returned result is
not used.
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=82531&r1=82530&r2=82531&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-convert.cpp (original)
+++ gcc-plugin/trunk/llvm-convert.cpp Tue Sep 22 02:08:44 2009
@@ -7969,7 +7969,16 @@
void TreeToLLVM::RenderGIMPLE_CALL(gimple stmt) {
tree lhs = gimple_call_lhs(stmt);
if (!lhs) {
- EmitGimpleCallRHS(stmt, 0);
+ // The returned value is not used.
+ if (!isAggregateTreeType(gimple_call_return_type(stmt))) {
+ EmitGimpleCallRHS(stmt, 0);
+ return;
+ }
+ // Create a temporary to hold the returned value.
+ // TODO: Figure out how to avoid creating this temporary and the
+ // associated useless code that stores the returned value into it.
+ MemRef Loc = CreateTempLoc(ConvertType(gimple_call_return_type(stmt)));
+ EmitGimpleCallRHS(stmt, &Loc);
return;
}
More information about the llvm-commits
mailing list