@@ -940,25 +940,27 @@ class AdjointGenerator
940
940
if (valType->isFPOrFPVectorTy()) {
941
941
FT = valType->getScalarType();
942
942
} else if (!valType->isPointerTy()) {
943
- if (looseTypeAnalysis) {
944
- auto fp = TR.firstPointer(storeSize, orig_ptr, /*errifnotfound*/ false,
945
- /*pointerIntSame*/ true);
946
- if (fp.isKnown()) {
947
- FT = fp.isFloat();
948
- } else if (isa<ConstantInt>(orig_val) ||
949
- valType->isIntOrIntVectorTy()) {
950
- llvm::errs() << "assuming type as integral for store: " << I << "\n";
951
- FT = nullptr;
952
- } else {
953
- TR.firstPointer(storeSize, orig_ptr, /*errifnotfound*/ true,
954
- /*pointerIntSame*/ true);
955
- llvm::errs() << "cannot deduce type of store " << I << "\n";
956
- assert(0 && "cannot deduce");
957
- }
943
+ auto fp = TR.firstPointer(storeSize, orig_ptr, /*errifnotfound*/ false,
944
+ /*pointerIntSame*/ true);
945
+ if (fp.isKnown()) {
946
+ FT = fp.isFloat();
947
+ } else if (looseTypeAnalysis && (isa<ConstantInt>(orig_val) ||
948
+ valType->isIntOrIntVectorTy())) {
949
+ llvm::errs() << "assuming type as integral for store: " << I << "\n";
950
+ FT = nullptr;
958
951
} else {
959
- FT = TR.firstPointer(storeSize, orig_ptr, /*errifnotfound*/ true,
960
- /*pointerIntSame*/ true)
961
- .isFloat();
952
+
953
+ if (CustomErrorHandler) {
954
+ std::string str;
955
+ raw_string_ostream ss(str);
956
+ ss << "Cannot deduce type of store " << I;
957
+ CustomErrorHandler(str.c_str(), wrap(&I), ErrorType::NoType,
958
+ &TR.analyzer);
959
+ }
960
+ EmitFailure("CannotDeduceType", I.getDebugLoc(), &I,
961
+ "failed to deduce type of store ", I);
962
+ TR.firstPointer(storeSize, orig_ptr, /*errifnotfound*/ true,
963
+ /*pointerIntSame*/ true);
962
964
}
963
965
}
964
966
0 commit comments