Use standard depth first iterators to simplify the implementation. Also
don't bother passing in ModuleCG when it is available in the class.
Details
- Reviewers
madhur13490 arsenm rampitec JonChesterfield
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp | ||
---|---|---|
246 | Please move this check inside the function otherwise every caller will have to do this check. |
llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp | ||
---|---|---|
234 | It is better to keep this assert. |
llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp | ||
---|---|---|
246 | I disagree. "Remove attributes from F" is a simpler API than "remove attributes from F, except if F is null". I have changed removeAttributes to take a reference to make it more obvious that F must be a function. Also, there is only one caller, and even before my patch there were two callers but only one of them had to cope with F possibly being null. This is caused by a quirk of the CallGraph which contains artificial nodes for external callers/callees, where getFunction returns null. |
llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp | ||
---|---|---|
246 | Yes, the quirks of CallGraph makes me worry about this. Please make sure it does not regress as I had to specifically check for !F as a result of failed AOMP smoke tests. |
Commit 660cae84c3144a42272daa16415fc9a2532773c4 reverts the base patch due to an unsupported scenario but thankfully this patch fixes that issue. Please rebase and keep the support intact.
Please remove NFC due to the new context. @JonChesterfield found an issue with recursions in the base patch. The following case depicts the scenario
target triple = "amdgcn-amd-amdhsa" define i64 @f(i64 %x) { entry: br i1 undef, label %return, label %if.end if.end: %call = call i64 @f(i64 undef) unreachable return: ret i64 1 } define i8* @unrelated() { entry: ret i8* bitcast (i64 (i64)* @f to i8*) } declare amdgpu_kernel void @has_a_kernel(i32)
Please add this test as a part of the patch.
This can probably be abandoned. The patch this was on top of was reverted. We also don't specially treat address taken functions anymore
It is better to keep this assert.