[llvm] [PowerPC] using milicode call for strcmp instead of lib call (PR #177009)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 21 11:17:37 PST 2026


================
@@ -9204,12 +9204,22 @@ getRuntimeCallSDValueHelper(SDValue Chain, const SDLoc &dl,
   CLI.setDebugLoc(dl)
       .setChain(Chain)
       .setLibCallee(DAG->getLibcalls().getLibcallImplCallingConv(LCImpl),
-                    CI->getType(), Callee, std::move(Args))
+                    CI->getType(), Callee, std::move(Args), *CI)
       .setTailCall(IsTailCall);
 
   return TLI->LowerCallTo(CLI);
 }
 
+std::pair<SDValue, SDValue> SelectionDAG::getStrcmp(SDValue Chain,
+                                                    const SDLoc &dl, SDValue S1,
+                                                    SDValue S2,
+                                                    const CallInst *CI) {
+  PointerType *PT = PointerType::getUnqual(*getContext());
+  TargetLowering::ArgListTy Args = {{S1, PT}, {S2, PT}};
+  return getRuntimeCallSDValueHelper(Chain, dl, std::move(Args), CI,
+                                     RTLIB::STRCMP, this, TLI);
----------------
RolandF77 wrote:

Is there some compelling reason to code the call this way. I notice that most other getStr*/getMem* functions use setLibCallee directly. It seems like doing it that way would enable you to set the return attributes in context to what they should be for that function, and avoid having to extend the setLibCallee interface?

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


More information about the llvm-commits mailing list