[llvm] [PowerPC][AIX] Using milicode for memcmp instead of libcall (PR #147093)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 6 20:08:06 PDT 2025


================
@@ -9065,8 +9065,15 @@ bool SelectionDAGBuilder::visitMemCmpBCmpCall(const CallInst &I) {
 
   // memcmp(S1,S2,2) != 0 -> (*(short*)LHS != *(short*)RHS)  != 0
   // memcmp(S1,S2,4) != 0 -> (*(int*)LHS != *(int*)RHS)  != 0
-  if (!CSize || !isOnlyUsedInZeroEqualityComparison(&I))
+  if (!CSize || !isOnlyUsedInZeroEqualityComparison(&I)) {
+    const Triple& TheTriple = TM.getTargetTriple();
+    if(TheTriple.isOSAIX()) {
+      if (Function *F = I.getCalledFunction()) {
+	F->setName(TheTriple.isArch32Bit() ? "___memcmp" : "___memcmp64");
----------------
arsenm wrote:

This is also mutating the IR, you cannot do that in codegen 

https://github.com/llvm/llvm-project/pull/147093


More information about the llvm-commits mailing list