[llvm-commits] [gcc-plugin] r83062 - /gcc-plugin/trunk/llvm-convert.cpp
Duncan Sands
baldrick at free.fr
Tue Sep 29 02:38:21 PDT 2009
Author: baldrick
Date: Tue Sep 29 04:38:21 2009
New Revision: 83062
URL: http://llvm.org/viewvc/llvm-project?rev=83062&view=rev
Log:
Functions may return complex numbers directly. Do not
generate invalid IR in this case.
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=83062&r1=83061&r2=83062&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-convert.cpp (original)
+++ gcc-plugin/trunk/llvm-convert.cpp Tue Sep 29 04:38:21 2009
@@ -860,11 +860,12 @@
}
if (RetVals.empty())
Builder.CreateRetVoid();
- else if (!Fn->getReturnType()->isAggregateType()) {
- assert(RetVals.size() == 1 && "Non-aggregate return has multiple values!");
+ else if (RetVals.size() == 1 && RetVals[0]->getType() == Fn->getReturnType()){
Builder.CreateRet(RetVals[0]);
- } else
+ } else {
+ assert(Fn->getReturnType()->isAggregateType() && "Return type mismatch!");
Builder.CreateAggregateRet(RetVals.data(), RetVals.size());
+ }
// Emit pending exception handling code.
EmitLandingPads();
More information about the llvm-commits
mailing list