mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Just don't transform this memset into "bzero" if no-builtin is specified.
llvm-svn: 56888
This commit is contained in:
parent
36e7e0b190
commit
618d422cdd
@ -5148,8 +5148,9 @@ X86TargetLowering::EmitTargetCodeForMemset(SelectionDAG &DAG,
|
||||
// Check to see if there is a specialized entry-point for memory zeroing.
|
||||
ConstantSDNode *V = dyn_cast<ConstantSDNode>(Src);
|
||||
|
||||
if (!NoBuiltin) {
|
||||
if (const char *bzeroEntry = V &&
|
||||
V->isNullValue() ? Subtarget->getBZeroEntry(NoBuiltin) : 0) {
|
||||
V->isNullValue() ? Subtarget->getBZeroEntry() : 0) {
|
||||
MVT IntPtr = getPointerTy();
|
||||
const Type *IntPtrTy = TD->getIntPtrType();
|
||||
TargetLowering::ArgListTy Args;
|
||||
@ -5165,6 +5166,7 @@ X86TargetLowering::EmitTargetCodeForMemset(SelectionDAG &DAG,
|
||||
DAG.getExternalSymbol(bzeroEntry, IntPtr), Args, DAG);
|
||||
return CallResult.second;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise have the target-independent code call memset.
|
||||
return SDValue();
|
||||
|
@ -63,10 +63,10 @@ bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV,
|
||||
/// interface like the non-standard bzero function, if such a function exists on
|
||||
/// the current subtarget and it is considered prefereable over memset with zero
|
||||
/// passed as the second argument. Otherwise it returns null.
|
||||
const char *X86Subtarget::getBZeroEntry(bool NoBuiltin) const {
|
||||
const char *X86Subtarget::getBZeroEntry() const {
|
||||
// Darwin 10 has a __bzero entry point for this purpose.
|
||||
if (getDarwinVers() >= 10)
|
||||
return NoBuiltin ? "_bzero" : "__bzero";
|
||||
return "__bzero";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ public:
|
||||
/// the current subtarget and it is considered prefereable over
|
||||
/// memset with zero passed as the second argument. Otherwise it
|
||||
/// returns null.
|
||||
const char *getBZeroEntry(bool NoBuiltin) const;
|
||||
const char *getBZeroEntry() const;
|
||||
};
|
||||
|
||||
namespace X86 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin10 | grep __bzero
|
||||
; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin10 -no-builtin | grep _bzero
|
||||
; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin10 -no-builtin | grep _memset
|
||||
|
||||
declare void @llvm.memset.i32(i8*, i8, i32, i32)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user