Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
autodiff_zero_cleanup.cpp
Go to the documentation of this file.
2
3#include <iostream>
4
5#include <thorin/lam.h>
6
10#include "thorin/plug/mem/mem.h"
11
12namespace thorin::plug::autodiff {
13
15 // Ideally this code segment is never reached.
16 // (all zeros are resolved before)
17 if (auto zero_app = match<zero>(def); zero_app) {
18 // callee = zero
19 // arg = type T
20 auto T = zero_app->arg();
21 world().DLOG("found a remaining autodiff::zero of {}", T);
22 // generate ⊥:T
23 auto dummy = world().bot(T);
24 return dummy;
25 }
26
27 return def;
28}
29
30} // namespace thorin::plug::autodiff
World & world()
Definition pass.h:296
Helper class to retrieve Infer::arg if present.
Definition def.h:87
Ref bot(Ref type)
Definition world.h:414
The automatic differentiation Plugin
Definition autodiff.h:7