[PATCH] D120266: [clang][CodeGen] Avoid emitting ifuncs with undefined resolvers

2022-02-26 Thread Itay Bookstein via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGf3480390be61: [clang][CodeGen] Avoid emitting ifuncs with undefined resolvers (authored by ibookstein). Repository: rG LLVM Github Monorepo CHANG

[PATCH] D120266: [clang][CodeGen] Avoid emitting ifuncs with undefined resolvers

2022-02-25 Thread Itay Bookstein via Phabricator via cfe-commits
ibookstein updated this revision to Diff 411521. ibookstein added a comment. Add tests for specific>usage>dispatch and dispatch>usage>specific orderings. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D120266/new/ https://reviews.llvm.org/D120266 Fi

[PATCH] D120266: [clang][CodeGen] Avoid emitting ifuncs with undefined resolvers

2022-02-25 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. In D120266#3345649 , @ibookstein wrote: > Ah, I saw your comment just now, good thing I didn't continue down that > plain-alias-name route then! > The change now satisfies that requirement in a way that binding against the >

[PATCH] D120266: [clang][CodeGen] Avoid emitting ifuncs with undefined resolvers

2022-02-25 Thread Itay Bookstein via Phabricator via cfe-commits
ibookstein added a comment. Ah, I saw your comment just now, good thing I didn't continue down that plain-alias-name route then! The change now satisfies that requirement in a way that binding against the alias name indeed would not: TU1 will have the callsite in `caller` bind against `foo.ifun

[PATCH] D120266: [clang][CodeGen] Avoid emitting ifuncs with undefined resolvers

2022-02-25 Thread Itay Bookstein via Phabricator via cfe-commits
ibookstein updated this revision to Diff 411409. ibookstein edited the summary of this revision. ibookstein added a comment. Changed code to generating a function declaration and 'upgrading' it to an ifunc instead of generating and ifunc and 'downgrading' it to a function declaration. I decided ag

[PATCH] D120266: [clang][CodeGen] Avoid emitting ifuncs with undefined resolvers

2022-02-23 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. In D120266#3341378 , @ibookstein wrote: > Yeah, that's what happens with this patch; Reference binds against an > `llvm::Function` declaration, linker resolves it to the actual ifunc in > another translation unit and therefo

[PATCH] D120266: [clang][CodeGen] Avoid emitting ifuncs with undefined resolvers

2022-02-23 Thread Itay Bookstein via Phabricator via cfe-commits
ibookstein added a comment. Yeah, that's what happens with this patch; Reference binds against an `llvm::Function` declaration, linker resolves it to the actual ifunc in another translation unit and therefore emits IFUNC relocation. Thinking about it more, this is inelegant. I would have liked

[PATCH] D120266: [clang][CodeGen] Avoid emitting ifuncs with undefined resolvers

2022-02-22 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments. Comment at: clang/lib/CodeGen/CodeGenModule.h:358 + /// function declarations when we do not emit a definition for the resolver. + std::vector MultiVersionIFuncs; + Optional: `SmallVector` typically compiles to less code. Reposi

[PATCH] D120266: [clang][CodeGen] Avoid emitting ifuncs with undefined resolvers

2022-02-22 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. So to clarify: The purpose of this patch is to change the call to an 'ifunc' (named FOO.ifunc) to an llvm::Function with the same name? And this later gets replaced by the cpu-dispatch version in the other translation unit? (or, is a linker failure?). Repository:

[PATCH] D120266: [clang][CodeGen] Avoid emitting ifuncs with undefined resolvers

2022-02-21 Thread Itay Bookstein via Phabricator via cfe-commits
ibookstein updated this revision to Diff 410360. ibookstein added a comment. clang-format + description wording Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D120266/new/ https://reviews.llvm.org/D120266 Files: clang/lib/CodeGen/CodeGenModule.cpp

[PATCH] D120266: [clang][CodeGen] Avoid emitting ifuncs with undefined resolvers

2022-02-21 Thread Itay Bookstein via Phabricator via cfe-commits
ibookstein created this revision. ibookstein added reviewers: erichkeane, rsmith, MaskRay. ibookstein requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. The purpose of this change is to fix the following codegen bug: // main.c __attribute__((