aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
diff options
context:
space:
mode:
authorVictor Perez <victor.perez@codeplay.com>2024-07-30 10:06:01 +0200
committerGitHub <noreply@github.com>2024-07-30 10:06:01 +0200
commite8f07cdb57602d71f8960c0499765bcb000745c2 (patch)
tree4d478063dbdd772f6b93d7422125a1975d32be50 /lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
parent78e7ec3be88bac7f3cd9ab32758156d479b0a106 (diff)
downloadllvm-e8f07cdb57602d71f8960c0499765bcb000745c2.zip
llvm-e8f07cdb57602d71f8960c0499765bcb000745c2.tar.gz
llvm-e8f07cdb57602d71f8960c0499765bcb000745c2.tar.bz2
[MLIR][SCF] Define `-scf-rotate-while` pass (#99850)
Define SCF dialect patterns rotating `scf.while` loops leveraging existing `mlir::scf::wrapWhileLoopInZeroTripCheck`. `forceCreateCheck` is always `false` as the pattern would lead to an infinite recursion otherwise. This pattern rotates `scf.while` ops, mutating them from "while" loops to "do-while" loops. A guard checking the condition for the first iteration is inserted. Note this guard can be optimized away if the compiler can prove the loop will be executed at least once. Using this pattern, the following while loop: ```mlir scf.while (%arg0 = %init) : (i32) -> i64 { %val = .., %arg0 : i64 %cond = arith.cmpi .., %arg0 : i32 scf.condition(%cond) %val : i64 } do { ^bb0(%arg1: i64): %next = .., %arg1 : i32 scf.yield %next : i32 } ``` Can be transformed into: ``` mlir %pre_val = .., %init : i64 %pre_cond = arith.cmpi .., %init : i32 scf.if %pre_cond -> i64 { %res = scf.while (%arg1 = %va0) : (i64) -> i64 { // Original after block %next = .., %arg1 : i32 // Original before block %val = .., %next : i64 %cond = arith.cmpi .., %next : i32 scf.condition(%cond) %val : i64 } do { ^bb0(%arg2: i64): %scf.yield %arg2 : i32 } scf.yield %res : i64 } else { scf.yield %pre_val : i64 } ``` The test pass for `wrapWhileLoopInZeroTripCheck` has been modified to use the new pattern when `forceCreateCheck=false`. --------- Signed-off-by: Victor Perez <victor.perez@codeplay.com>
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h')
0 files changed, 0 insertions, 0 deletions