[all-commits] [llvm/llvm-project] ba4545: [SimplifyCFG] Skip threading if the target may hav...

darkbuck via All-commits all-commits at lists.llvm.org
Fri Jul 26 09:16:10 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ba45453c0a5df3e6c3eddee647e14c97e02243fa
      https://github.com/llvm/llvm-project/commit/ba45453c0a5df3e6c3eddee647e14c97e02243fa
  Author: darkbuck <michael.hliao at gmail.com>
  Date:   2024-07-26 (Fri, 26 Jul 2024)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    A llvm/test/Transforms/SimplifyCFG/AMDGPU/skip-threading.ll
    M llvm/test/Transforms/SimplifyCFG/convergent.ll

  Log Message:
  -----------
  [SimplifyCFG] Skip threading if the target may have divergent branches

- This patch skips the threading on known values if the target has
  divergent branch.
- So far, threading on known values is skipped when the basic block has
  covergent calls. However, even without convergent calls, if that
  condition is divergent, threading duplicates the execution of that
  block threaded and hence results in lower performance. E.g.,
  ```
  BB1:
    if (cond) BB3, BB2

  BB2:
    // work2
    br BB3

  BB3:
    // work3
    if (cond) BB5, BB4

  BB4:
    // work4
    br BB5

  BB5:
  ```

  after threading,

  ```
  BB1:
    if (cond) BB3', BB2'

  BB2':
    // work3
    br BB5

  BB3':
    // work2
    // work3
    // work4
    br BB5

  BB5:

  ```

  After threading, work3 is executed twice if 'cond' is a divergent one.

Reviewers: yxsamliu, nikic

Pull Request: https://github.com/llvm/llvm-project/pull/100185



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list