[PATCH] D120260: [BOLT][NFC] Fix undefined behavior in encodeAnnotationImm

Maksim Panchenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 23 14:04:08 PST 2022


maksfb added inline comments.


================
Comment at: bolt/unittests/Core/MCPlusBuilder.cpp:113
+TEST_P(MCPlusBuilderTester, Annotation) {
+  if (GetParam() != Triple::x86_64)
+    GTEST_SKIP();
----------------
yota9 wrote:
> Amir wrote:
> > yota9 wrote:
> > > Amir wrote:
> > > > maksfb wrote:
> > > > > Any reason for x86_64-only?
> > > > `createCall` is not defined in AArch64MCPlusBuilder
> > > Sorry, but why not just use BC->MIB->addAnnotation directly? 
> > There's no way to put a predefined Value into an encoded annotation immediate using addAnnotation.
> > addAnnotation allocates a `MCSimpleAnnotation<ValueType>` using placement new, and passes the pointer to allocated object to
> > setAnnotationOpValue.
> > 
> > https://github.com/llvm/llvm-project/blob/main/bolt/include/bolt/Core/MCPlusBuilder.h#L1639
> Oh yes, I forgot about that, thanks.
> createCall is not defined in AArch64MCPlusBuilder

Interesting. But it has `createTailCall(). Can we use that for testing?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120260/new/

https://reviews.llvm.org/D120260



More information about the llvm-commits mailing list