@@ -8,7 +8,7 @@ use crate::qptr::{shapes, QPtrAttr, QPtrMemUsage, QPtrMemUsageKind, QPtrOp, QPtr
8
8
use crate :: transform:: { InnerInPlaceTransform , InnerTransform , Transformed , Transformer } ;
9
9
use crate :: {
10
10
spv, AddrSpace , Attr , AttrSet , AttrSetDef , Const , ConstCtor , ConstDef , Context , ControlNode ,
11
- ControlNodeKind , DataInst , DataInstDef , DataInstKind , DeclDef , Diag , EntityDefs ,
11
+ ControlNodeKind , DataInst , DataInstDef , DataInstKind , DeclDef , Diag , DiagLevel , EntityDefs ,
12
12
EntityOrientedDenseMap , Func , FuncDecl , FxIndexMap , GlobalVar , GlobalVarDecl , Module , Type ,
13
13
TypeCtor , TypeCtorArg , TypeDef , Value ,
14
14
} ;
@@ -1156,7 +1156,28 @@ impl Transformer for LiftToSpvPtrInstsInFunc<'_> {
1156
1156
self . add_value_uses ( & data_inst_def. inputs ) ;
1157
1157
}
1158
1158
Err ( LiftError ( e) ) => {
1159
- func_at_inst. def ( ) . attrs . push_diag ( & self . lifter . cx , e) ;
1159
+ let data_inst_def = func_at_inst. def ( ) ;
1160
+
1161
+ // HACK(eddyb) do not add redundant errors to `qptr::analyze` bugs.
1162
+ let has_qptr_analysis_bug_diags = self . lifter . cx [ data_inst_def. attrs ]
1163
+ . attrs
1164
+ . iter ( )
1165
+ . any ( |attr| match attr {
1166
+ Attr :: Diagnostics ( diags) => {
1167
+ diags. 0 . iter ( ) . any ( |diag| match diag. level {
1168
+ DiagLevel :: Bug ( loc) => {
1169
+ loc. file ( ) . ends_with ( "qptr/analyze.rs" )
1170
+ || loc. file ( ) . ends_with ( "qptr\\ analyze.rs" )
1171
+ }
1172
+ _ => false ,
1173
+ } )
1174
+ }
1175
+ _ => false ,
1176
+ } ) ;
1177
+
1178
+ if !has_qptr_analysis_bug_diags {
1179
+ data_inst_def. attrs . push_diag ( & self . lifter . cx , e) ;
1180
+ }
1160
1181
}
1161
1182
}
1162
1183
}
0 commit comments