[all-commits] [llvm/llvm-project] 40b0ab: [SimplifyCFG] Pre-commit test for extending HoistT...

DianQK via All-commits all-commits at lists.llvm.org
Tue Sep 19 16:22:35 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 40b0ab287f9f5c58fa35a9a97cc49f104bef45ed
      https://github.com/llvm/llvm-project/commit/40b0ab287f9f5c58fa35a9a97cc49f104bef45ed
  Author: DianQK <dianqk at dianqk.net>
  Date:   2023-09-20 (Wed, 20 Sep 2023)

  Changed paths:
    M llvm/test/Transforms/SimplifyCFG/HoistCode.ll
    A llvm/test/Transforms/SimplifyCFG/hoist-common-code-with-unreachable.ll
    M llvm/test/Transforms/SimplifyCFG/hoist-common-code.ll
    M llvm/test/Transforms/SimplifyCFG/hoist-with-metadata.ll

  Log Message:
  -----------
  [SimplifyCFG] Pre-commit test for extending HoistThenElseCodeToIf.

Pre-commit test for D155711.

Differential Revision: https://reviews.llvm.org/D156617


  Commit: 96ea48ff5dcba46af350f5300eafd7f7394ba606
      https://github.com/llvm/llvm-project/commit/96ea48ff5dcba46af350f5300eafd7f7394ba606
  Author: DianQK <dianqk at dianqk.net>
  Date:   2023-09-20 (Wed, 20 Sep 2023)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/CodeGen/AArch64/patchable-function-entry-bti.ll
    M llvm/test/Transforms/SimplifyCFG/HoistCode.ll
    M llvm/test/Transforms/SimplifyCFG/hoist-common-code-with-unreachable.ll
    M llvm/test/Transforms/SimplifyCFG/hoist-common-code.ll
    M llvm/test/Transforms/SimplifyCFG/hoist-common-skip.ll
    M llvm/test/Transforms/SimplifyCFG/hoist-with-metadata.ll

  Log Message:
  -----------
  [SimplifyCFG] Hoist common instructions on Switch.

Sink common instructions are not always performance friendly. We need to implement hoist common instructions on switch instruction to solve the following problem:
```
define i1 @foo(i64 %a, i64 %b, i64 %c, i64 %d) {
start:
  %test = icmp eq i64 %a, %d
  br i1 %test, label %switch_bb, label %exit

switch_bb:                                        ; preds = %start
  switch i64 %a, label %bb0 [
    i64 1, label %bb1
    i64 2, label %bb2
  ]

bb0:                                              ; preds = %switch_bb
  %0 = icmp eq i64 %b, %c
  br label %exit

bb1:                                              ; preds = %switch_bb
  %1 = icmp eq i64 %b, %c
  br label %exit

bb2:                                              ; preds = %switch_bb
  %2 = icmp eq i64 %b, %c
  br label %exit

exit:                                             ; preds = %bb2, %bb1, %bb0, %start
  %result = phi i1 [ false, %start ], [ %0, %bb0 ], [ %1, %bb1 ], [ %2, %bb2 ]
  ret i1 %result
}
```
The pre-commit test is D156617.

Reviewed By: XChy, nikic

Differential Revision: https://reviews.llvm.org/D155711


Compare: https://github.com/llvm/llvm-project/compare/2baf4a06ef06...96ea48ff5dcb


More information about the All-commits mailing list