File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -293,14 +293,16 @@ struct ArithRaisingPass
293
293
op->walk ([=](arith::ConstantOp constOp) {
294
294
if (!use_stablehlo || !isa<RankedTensorType>(constOp.getType ()))
295
295
return ;
296
- auto CT = constOp.getType ();
297
- if (isa<TensorType>(CT)) {
298
- OpBuilder builder (constOp);
299
- Value newConstOp = builder.create <stablehlo::ConstantOp>(
300
- constOp.getLoc (), constOp.getValueAttr ());
301
- constOp.replaceAllUsesWith (newConstOp);
302
- constOp.erase ();
303
- }
296
+
297
+ auto valueAttr = constOp.getValueAttr ();
298
+ if (!isa<ElementsAttr>(valueAttr))
299
+ return ;
300
+
301
+ OpBuilder builder (constOp);
302
+ Value newConstOp =
303
+ builder.create <stablehlo::ConstantOp>(constOp.getLoc (), valueAttr);
304
+ constOp.replaceAllUsesWith (newConstOp);
305
+ constOp.erase ();
304
306
});
305
307
op->walk ([=](arith::FPToSIOp addOp) {
306
308
if (!use_stablehlo || !isa<RankedTensorType>(addOp->getResultTypes ()[0 ]))
You can’t perform that action at this time.
0 commit comments