File tree 2 files changed +32
-0
lines changed
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -1151,6 +1151,22 @@ void TypeAnalyzer::visitValue(Value &val) {
1151
1151
if (!isa<Argument>(&val) && !isa<Instruction>(&val))
1152
1152
return ;
1153
1153
1154
+ #if LLVM_VERSION_MAJOR >= 10
1155
+ if (auto *FPMO = dyn_cast<FPMathOperator>(&val)) {
1156
+ if (FPMO->getOpcode () == Instruction::FNeg) {
1157
+ Value *op = FPMO->getOperand (0 );
1158
+ auto ty = op->getType ()->getScalarType ();
1159
+ assert (ty->isFloatingPointTy ());
1160
+ ConcreteType dt (ty);
1161
+ updateAnalysis (op, TypeTree (ty).Only (-1 , nullptr ),
1162
+ cast<Instruction>(&val));
1163
+ updateAnalysis (FPMO, TypeTree (ty).Only (-1 , nullptr ),
1164
+ cast<Instruction>(&val));
1165
+ return ;
1166
+ }
1167
+ }
1168
+ #endif
1169
+
1154
1170
if (auto inst = dyn_cast<Instruction>(&val)) {
1155
1171
visit (*inst);
1156
1172
}
Original file line number Diff line number Diff line change
1
+ ; RUN: if [ %llvmver -ge 10 ]; then %opt < %s %loadEnzyme -print-type-analysis -type-analysis-func=caller -o /dev/null | FileCheck %s; fi
2
+
3
+ declare double @f ()
4
+
5
+ define void @caller () {
6
+ entry:
7
+ %c = call double @f ()
8
+ %n = fneg double %c
9
+ ret void
10
+ }
11
+
12
+ ; CHECK: caller - {} |
13
+ ; CHECK-NEXT: entry
14
+ ; CHECK-NEXT: %c = call double @f(): {[-1]:Float@double}
15
+ ; CHECK-NEXT: %n = fneg double %c: {[-1]:Float@double}
16
+ ; CHECK-NEXT: ret void: {}
You can’t perform that action at this time.
0 commit comments