[llvm] [AMDGPU] AMDGPULateCodeGenPrepare Legacy PM: replace `setPreservesAll()` with `setPreservesCFG()` (PR #148167)
Jim M. R. Teichgräber via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 11 07:48:29 PDT 2025
================
@@ -546,7 +546,9 @@ class AMDGPULateCodeGenPrepareLegacy : public FunctionPass {
AU.addRequired<TargetPassConfig>();
AU.addRequired<AssumptionCacheTracker>();
AU.addRequired<UniformityInfoWrapperPass>();
- AU.setPreservesAll();
+ // This pass makes changes that can invalidate Uniformity Analysis,
+ // so don't setPreserveAll() here (see new PM version above).
+ AU.setPreservesCFG();
----------------
J-MR-T wrote:
I see. I agree that the "(see new PM version)" part is perhaps irrelevant, but let me lay out my reasoning for the rest of the comment. Though I'd also be fine with removing the comment ofc.
I added it because it immediately follows the actual 2 analyses that are used, i.e. the
```c++
AU.addRequired<AssumptionCacheTracker>();
AU.addRequired<UniformityInfoWrapperPass>();
```
lines. The comment is basically intended to say "those are the analyses used by this pass, given that one of them is invalidated, a necessary condition is not fulfilled for `setPreservesAll()`, so `setPreservesCFG()` is the next-most suitable option". Also to make this clear for any future edits where using `setPreservesAll()` might be considered.
https://github.com/llvm/llvm-project/pull/148167
More information about the llvm-commits
mailing list