[PATCH] D109792: Resolve {GlobalValue,GloalIndirectSymol}::getBaseObject confusion

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 15 22:36:16 PDT 2021


MaskRay marked 2 inline comments as done.
MaskRay added inline comments.


================
Comment at: llvm/lib/Object/IRSymtab.cpp:289
+    if (isa<GlobalIFunc>(GV))
+      Base = cast<GlobalObject>(cast<GlobalIFunc>(GV)->getResolver())
+                 ->getBaseObject();
----------------
ibookstein wrote:
> This will crash on bitcasts, see e.g. https://clang.godbolt.org/z/ssxrj9b7d
> In other words, code that wants to deal with getting the resolver of a GlobalIFunc took a reliance upon the ConstantExpr-peeling machinery of findBaseObject() that was previously utilized only by GlobalAlias prior to the introduction of GlobalIFunc. It is unclear to me whether all the ConstantExpr handlings in findBaseObject() are needed in the case of GlobalIFunc-s.
Thanks for the example. Added `strlen` to llvm/test/LTO/Resolution/X86/ifunc.ll to catch the regression.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109792



More information about the llvm-commits mailing list