[llvm-commits] [dragonegg] r90231 - in /dragonegg/trunk: llvm-convert.cpp llvm-internal.h
Duncan Sands
baldrick at free.fr
Tue Dec 1 05:34:20 PST 2009
Author: baldrick
Date: Tue Dec 1 07:34:20 2009
New Revision: 90231
URL: http://llvm.org/viewvc/llvm-project?rev=90231&view=rev
Log:
The argument to builtin_expect is a scalar - use EmitGimpleReg
rather than Emit with DestLoc. While there, return 0 if the
builtin_expect has too few operands, like in gcc.
Modified:
dragonegg/trunk/llvm-convert.cpp
dragonegg/trunk/llvm-internal.h
Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=90231&r1=90230&r2=90231&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Tue Dec 1 07:34:20 2009
@@ -4288,7 +4288,7 @@
case BUILT_IN_CONSTANT_P: return EmitBuiltinConstantP(stmt, Result);
case BUILT_IN_ALLOCA: return EmitBuiltinAlloca(stmt, Result);
case BUILT_IN_EXTEND_POINTER: return EmitBuiltinExtendPointer(stmt, Result);
- case BUILT_IN_EXPECT: return EmitBuiltinExpect(stmt, DestLoc, Result);
+ case BUILT_IN_EXPECT: return EmitBuiltinExpect(stmt, Result);
case BUILT_IN_MEMCPY: return EmitBuiltinMemCopy(stmt, Result,
false, false);
case BUILT_IN_MEMCPY_CHK: return EmitBuiltinMemCopy(stmt, Result,
@@ -5503,13 +5503,12 @@
return true;
}
-bool TreeToLLVM::EmitBuiltinExpect(gimple stmt, const MemRef *DestLoc,
- Value *&Result) {
+bool TreeToLLVM::EmitBuiltinExpect(gimple stmt, Value *&Result) {
// Ignore the hint for now, just expand the expr. This is safe, but not
// optimal.
- if (gimple_call_num_args(stmt) < 2)
- return true;
- Result = Emit(gimple_call_arg(stmt, 0), DestLoc);
+ Result = gimple_call_num_args(stmt) < 2 ?
+ Constant::getNullValue(ConvertType(gimple_call_return_type(stmt))) :
+ EmitGimpleReg(gimple_call_arg(stmt, 0));
return true;
}
Modified: dragonegg/trunk/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-internal.h?rev=90231&r1=90230&r2=90231&view=diff
==============================================================================
--- dragonegg/trunk/llvm-internal.h (original)
+++ dragonegg/trunk/llvm-internal.h Tue Dec 1 07:34:20 2009
@@ -689,7 +689,7 @@
bool EmitBuiltinConstantP(gimple stmt, Value *&Result);
bool EmitBuiltinAlloca(gimple stmt, Value *&Result);
- bool EmitBuiltinExpect(gimple stmt, const MemRef *DestLoc, Value *&Result);
+ bool EmitBuiltinExpect(gimple stmt, Value *&Result);
bool EmitBuiltinExtendPointer(gimple stmt, Value *&Result);
bool EmitBuiltinVAStart(gimple stmt);
bool EmitBuiltinVAEnd(gimple stmt);
More information about the llvm-commits
mailing list