[all-commits] [llvm/llvm-project] a562f6: [flang][FIR] add canonicalization pattern for fir....
jeanPerier via All-commits
all-commits at lists.llvm.org
Wed Jun 24 02:35:49 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a562f6a4833eb15d8d2fdbd54c27c595935ff275
https://github.com/llvm/llvm-project/commit/a562f6a4833eb15d8d2fdbd54c27c595935ff275
Author: jeanPerier <jperier at nvidia.com>
Date: 2026-06-24 (Wed, 24 Jun 2026)
Changed paths:
M flang/include/flang/Optimizer/Dialect/FIROps.td
M flang/lib/Optimizer/Dialect/FIROps.cpp
A flang/test/Fir/present-absent-if-fold.fir
Log Message:
-----------
[flang][FIR] add canonicalization pattern for fir.if returning OPTIONAL (#205353)
Lowering is generating patterns when forwarding OPTIONAL in calls that
looks like:
```
%present = fir.is_present %var : (T) -> i1
%if_result = fir.if %present -> (T) {
fir.result %var : T
} else {
%absent = fir.absent T
fir.result %absent : T
}
```
This specific pattern is a no-op and `%var` can be used directly. The
lowering logic that generates such patterns is inside non trivial
compiler code that has to deal with more complex scenarios where the
code inside the fir.if is more complex. Add a FIR pattern to
canonicalize such code to help with later analysis (like aliasing).
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