|
| 1 | +; RUN: %opt < %s %loadEnzyme -enzyme -enzyme-preopt=false -mem2reg -instsimplify -adce -correlated-propagation -simplifycfg -S | FileCheck %s |
| 2 | + |
| 3 | +; ModuleID = 'ld-temp.o' |
| 4 | +source_filename = "ld-temp.o" |
| 5 | +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 6 | +target triple = "x86_64-unknown-linux-gnu" |
| 7 | + |
| 8 | +%"struct.std::_Rb_tree_node_base" = type { i32, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"* } |
| 9 | + |
| 10 | +@enzyme_dup = external dso_local local_unnamed_addr global i32, align 4 |
| 11 | +@enzyme_const = external dso_local local_unnamed_addr global i32, align 4 |
| 12 | + |
| 13 | +declare dso_local i32 @_Z17__enzyme_autodiff(...) |
| 14 | + |
| 15 | +; Function Attrs: mustprogress nofree nounwind readonly willreturn |
| 16 | +declare dso_local %"struct.std::_Rb_tree_node_base"* @_ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base(%"struct.std::_Rb_tree_node_base"*) local_unnamed_addr |
| 17 | + |
| 18 | +; Function Attrs: mustprogress nofree nounwind readonly willreturn |
| 19 | +declare dso_local %"struct.std::_Rb_tree_node_base"* @_ZSt18_Rb_tree_decrementPKSt18_Rb_tree_node_base(%"struct.std::_Rb_tree_node_base"*) local_unnamed_addr |
| 20 | + |
| 21 | +define dso_local i32 @callable(%"struct.std::_Rb_tree_node_base"* %i0) { |
| 22 | + %i1 = call %"struct.std::_Rb_tree_node_base"* @_ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base(%"struct.std::_Rb_tree_node_base"* %i0) |
| 23 | + %i2 = call %"struct.std::_Rb_tree_node_base"* @_ZSt18_Rb_tree_decrementPKSt18_Rb_tree_node_base(%"struct.std::_Rb_tree_node_base"* %i1) |
| 24 | + ret i32 0 |
| 25 | +} |
| 26 | + |
| 27 | +define dso_local i32 @main(%"struct.std::_Rb_tree_node_base"* %i0, %"struct.std::_Rb_tree_node_base"* %shaddow) { |
| 28 | + %id = load i32, i32* @enzyme_dup, align 4 |
| 29 | + %i1 = call i32 (...) @_Z17__enzyme_autodiff(i8* bitcast (i32 (%"struct.std::_Rb_tree_node_base"*)* @callable to i8*), i32 %id, %"struct.std::_Rb_tree_node_base"* nonnull align 8 dereferenceable(24) %i0, %"struct.std::_Rb_tree_node_base"* nonnull align 8 dereferenceable(24) %shaddow) |
| 30 | + ret i32 0 |
| 31 | +} |
| 32 | + |
| 33 | +; CHECK: define internal void @diffecallable(%"struct.std::_Rb_tree_node_base"* %i0, %"struct.std::_Rb_tree_node_base"* %"i0'") |
| 34 | +; CHECK-NEXT: invert: |
| 35 | +; CHECK-NEXT: %i1 = call %"struct.std::_Rb_tree_node_base"* @_ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base(%"struct.std::_Rb_tree_node_base"* %i0) |
| 36 | +; CHECK-NEXT: %i2 = call %"struct.std::_Rb_tree_node_base"* @_ZSt18_Rb_tree_decrementPKSt18_Rb_tree_node_base(%"struct.std::_Rb_tree_node_base"* %i1) |
| 37 | +; CHECK-NEXT: ret void |
| 38 | +; CHECK-NEXT: } |
0 commit comments