[llvm] [clang] [SimplifyCFG] Not folding branch in loop header with constant iterations (PR #74268)

via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 3 22:16:28 PST 2023


xiangzh1 wrote:

> We should add TTI check for the condition. I believe don't unroll on X86 is a correct decision. Only like AMDGPU or NVPTX these GPU backend with heavy stack cost need this.
> 
> And I think you need to precommit tests first.

In fact, there is no direct/strong relation with stack cost, it mostly base on unroll or not (or other loop optimizations). Maybe we should check "unroll" info (e.g #pragma unroll) before do or not do this folding. A little trouble is loop info is not well established now.

https://github.com/llvm/llvm-project/pull/74268


More information about the cfe-commits mailing list