[PATCH] D36534: [aarch64] Support APInt and APFloat in ImmLeaf subclasses and make AArch64 use them.

Daniel Sanders via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 10:51:25 PDT 2017


dsanders added a comment.

In https://reviews.llvm.org/D36534#893457, @aemerson wrote:

> In https://reviews.llvm.org/D36534#893372, @dsanders wrote:
>
> > Rebased to trunk. I'll fix the comments I've received shortly.
> >
> > This patch now requires r315148 to be reverted. That patch changed
> >  getPredCode() and getImmCode() to return StringRef's but this patch requires
> >  that getPredCode() return a std::string. We could revert just the getPredCode()
> >  portion of that patch if we want but I think it would be weird for the two
> >  functions to require different usage.
>
>
> I'm just curious, what's the issue with it returning a StringRef?


getPredCode() needs to build the code from several substrings depending on the data type of the ImmLeaf subclass. StringRef's don't own the data they reference so it will end up referencing a local that's destroyed by the exit from getPredCode().


https://reviews.llvm.org/D36534





More information about the llvm-commits mailing list