Skip to content

Commit

Permalink
Add no type error (rust-lang#672)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored May 28, 2022
1 parent e95c410 commit 1fa0a99
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
7 changes: 7 additions & 0 deletions enzyme/Enzyme/AdjointGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -2814,6 +2814,13 @@ class AdjointGenerator
vd = TypeTree(BaseType::Pointer).Only(0);
goto known;
}
if (CustomErrorHandler) {
std::string str;
raw_string_ostream ss(str);
ss << "Cannot deduce type of copy " << MTI;
CustomErrorHandler(str.c_str(), wrap(&MTI), ErrorType::NoType,
&TR.analyzer);
}
EmitFailure("CannotDeduceType", MTI.getDebugLoc(), &MTI,
"failed to deduce type of copy ", MTI);

Expand Down
3 changes: 2 additions & 1 deletion enzyme/Enzyme/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ class ScalarEvolution;
enum class ErrorType {
NoDerivative = 0,
NoShadow = 1,
IllegalTypeAnalysis = 2
IllegalTypeAnalysis = 2,
NoType = 3
};

extern "C" {
Expand Down
6 changes: 3 additions & 3 deletions enzyme/test/Enzyme/ForwardMode/fmuladd.ll
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ declare double @__enzyme_fwddiff(double (double, double, double)*, ...)

; CHECK: define internal double @fwddiffetester(double %x, double %"x'", double %y, double %"y'", double %z, double %"z'")
; CHECK-NEXT: entry:
; CHECK-NEXT: %0 = fmul fast double %y, %"x'"
; CHECK-NEXT: %1 = fmul fast double %x, %"y'"
; CHECK-NEXT: %2 = fadd fast double %1, %0
; CHECK-DAG: %[[i0:.+]] = fmul fast double %y, %"x'"
; CHECK-DAG: %[[i1:.+]] = fmul fast double %x, %"y'"
; CHECK-NEXT: %2 = fadd fast double %[[i1]], %[[i0]]
; CHECK-NEXT: %3 = fadd fast double %2, %"x'"
; CHECK-NEXT: ret double %3
; CHECK-NEXT: }

0 comments on commit 1fa0a99

Please sign in to comment.