forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add forward mode fadd and free debug (rust-lang#674)
- Loading branch information
Showing
3 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
; RUN: if [ %llvmver -ge 9 ]; then %opt < %s %loadEnzyme -enzyme -enzyme-preopt=false -mem2reg -instsimplify -adce -loop-deletion -correlated-propagation -simplifycfg -S | FileCheck %s; fi | ||
|
||
; Function Attrs: norecurse nounwind readonly uwtable | ||
define dso_local double @sum(double* nocapture %n, double %x) #0 { | ||
entry: | ||
%res = atomicrmw fadd double* %n, double %x monotonic | ||
ret double %res | ||
} | ||
|
||
; Function Attrs: nounwind uwtable | ||
define dso_local void @dsum(double* %x, double* %xp, double %n) local_unnamed_addr #1 { | ||
entry: | ||
%0 = tail call double (double (double*, double)*, ...) @__enzyme_fwddiff(double (double*, double)* nonnull @sum, double* %x, double* %xp, double %n, double 1.000000e+00) | ||
ret void | ||
} | ||
|
||
; Function Attrs: nounwind | ||
declare double @__enzyme_fwddiff(double (double*, double)*, ...) #2 | ||
|
||
attributes #0 = { norecurse nounwind readonly uwtable } | ||
attributes #1 = { nounwind uwtable } | ||
attributes #2 = { nounwind } | ||
|
||
; CHECK: define internal double @fwddiffesum(double* nocapture %n, double* nocapture %"n'", double %x, double %"x'") | ||
; CHECK-NEXT: entry: | ||
; CHECK-NEXT: %res = atomicrmw fadd double* %n, double %x monotonic | ||
; CHECK-NEXT: %0 = atomicrmw fadd double* %"n'", double %"x'" monotonic | ||
; CHECK-NEXT: ret double %0 | ||
; CHECK-NEXT: } |