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.
Fix constant instruction binop in forward mode (rust-lang#680)
* Fix constant instruction binop in forward mode * Fix llvm7
- Loading branch information
Showing
2 changed files
with
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
; RUN: %opt < %s %loadEnzyme -enzyme -enzyme-preopt=false -mem2reg -instsimplify -simplifycfg -S | FileCheck %s | ||
|
||
declare void @_Z16__enzyme_fwddiff(...) | ||
|
||
define void @_Z34testFwdDerivativesRosenbrockEnzymev(i8* %a, i8* %b) { | ||
call void (...) @_Z16__enzyme_fwddiff(double (i64*)* @f, metadata !"enzyme_dup", i8* %a, i8* %b) | ||
ret void | ||
} | ||
|
||
define double @f(i64* %i10) { | ||
bb: | ||
%i13 = load i64, i64* %i10, align 8 | ||
%i14 = sub i64 2, %i13 | ||
%i15 = sdiv exact i64 %i14, 8 | ||
%a5 = uitofp i64 %i15 to double | ||
ret double %a5 | ||
} | ||
|
||
; CHECK: define internal double @fwddiffef(i64* %i10, i64* %"i10'") | ||
; CHECK-NEXT: bb: | ||
; CHECK-NEXT: ret double 0.000000e+00 | ||
; CHECK-NEXT: } |