[llvm] [AArch64][SME] Lower memchr to __arm_sc_memchr in streaming[-compatible] functions (PR #168896)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 1 07:18:40 PST 2025


================
@@ -194,7 +200,11 @@ SDValue AArch64SelectionDAGInfo::EmitStreamingCompatibleMemLibCall(
   PointerType *RetTy = PointerType::getUnqual(*DAG.getContext());
   CLI.setDebugLoc(DL).setChain(Chain).setLibCallee(
       TLI->getLibcallCallingConv(NewLC), RetTy, Symbol, std::move(Args));
-  return TLI->LowerCallTo(CLI).second;
+
+  auto [Result, ChainOut] = TLI->LowerCallTo(CLI);
+  if (LC == RTLIB::MEMCHR)
----------------
MacDue wrote:

Assuming you changed this to: `return Chain` (the other option crashes). It works because of implementation details of `TLI->LowerCallTo` (which are not guaranteed, AFAIK). 

The returned chain node happens to be: 

```
t21: i64,ch,glue = CopyFromReg t20, Register:i64 $physreg239, t20:1
```

So `std::make_pair(Result.getValue(0), Result.getValue(1))`  in `EmitTargetCodeForMemchr` still ends up returning the correct values.


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


More information about the llvm-commits mailing list