Skip to content

Commit 16a43af

Browse files
committed
implement milicode memcmp
1 parent 7b517cf commit 16a43af

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9065,8 +9065,15 @@ bool SelectionDAGBuilder::visitMemCmpBCmpCall(const CallInst &I) {
90659065

90669066
// memcmp(S1,S2,2) != 0 -> (*(short*)LHS != *(short*)RHS) != 0
90679067
// memcmp(S1,S2,4) != 0 -> (*(int*)LHS != *(int*)RHS) != 0
9068-
if (!CSize || !isOnlyUsedInZeroEqualityComparison(&I))
9068+
if (!CSize || !isOnlyUsedInZeroEqualityComparison(&I)) {
9069+
const Triple& TheTriple = TM.getTargetTriple();
9070+
if(TheTriple.isOSAIX()) {
9071+
if (Function *F = I.getCalledFunction()) {
9072+
F->setName(TheTriple.isArch32Bit() ? "___memcmp" : "___memcmp64");
9073+
}
9074+
}
90699075
return false;
9076+
}
90709077

90719078
// If the target has a fast compare for the given size, it will return a
90729079
// preferred load type for that size. Require that the load VT is legal and

0 commit comments

Comments
 (0)