Hi there lowering experts, Can the llvm.mem* intrinsics ever turn into a library call? Or do they invariably turn into inline code? This comes up because there was a patch to StackProtector to use CaptureTracking instead of a home-grown analysis, which changes the treatment of calls to intrinsics. (The old code treated them as normal calls, the new code decides intrinsics can never capture.) But if llvm.mem* intrinsics can turn into real function calls, we need to pay attention to that. Thanks, --paulr
Finkel, Hal J. via llvm-dev
2019-Sep-10 19:34 UTC
[llvm-dev] Question on llvm.mem* intrinsics
On 9/10/19 2:09 PM, via llvm-dev wrote:> Hi there lowering experts, > > Can the llvm.mem* intrinsics ever turn into a library call? Or do > they invariably turn into inline code?These can certainly turn into library calls. See, for example, the code in: SelectionDAG::getMemcpy (in SelectionDAG.cpp), which is called by the code in SelectionDAGBuilder::visitIntrinsicCall (in SelectionDAGBuilder.cpp) handling Intrinsic::memcpy. -Hal> > This comes up because there was a patch to StackProtector to use > CaptureTracking instead of a home-grown analysis, which changes > the treatment of calls to intrinsics. (The old code treated them > as normal calls, the new code decides intrinsics can never capture.) > But if llvm.mem* intrinsics can turn into real function calls, we > need to pay attention to that. > > Thanks, > --paulr > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- Hal Finkel Lead, Compiler Technology and Programming Languages Leadership Computing Facility Argonne National Laboratory
> -----Original Message----- > From: Finkel, Hal J. [mailto:hfinkel at anl.gov] > Sent: Tuesday, September 10, 2019 3:35 PM > To: Robinson, Paul; llvm-dev at lists.llvm.org > Subject: Re: [llvm-dev] Question on llvm.mem* intrinsics > > > On 9/10/19 2:09 PM, via llvm-dev wrote: > > Hi there lowering experts, > > > > Can the llvm.mem* intrinsics ever turn into a library call? Or do > > they invariably turn into inline code? > > > These can certainly turn into library calls. See, for example, the code > in: > > SelectionDAG::getMemcpy (in SelectionDAG.cpp), which is called by the > code in SelectionDAGBuilder::visitIntrinsicCall (in > SelectionDAGBuilder.cpp) handling Intrinsic::memcpy. > > -HalThanks Hal! There are certainly places in LLVM that assume intrinsics are never real calls. `isLoweredToCall()` returns false for all intrinsics. I was suspicious about the mem* calls though, and happy to get a confirmation. --paulr> > > > > > This comes up because there was a patch to StackProtector to use > > CaptureTracking instead of a home-grown analysis, which changes > > the treatment of calls to intrinsics. (The old code treated them > > as normal calls, the new code decides intrinsics can never capture.) > > But if llvm.mem* intrinsics can turn into real function calls, we > > need to pay attention to that. > > > > Thanks, > > --paulr > > > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > -- > Hal Finkel > Lead, Compiler Technology and Programming Languages > Leadership Computing Facility > Argonne National Laboratory