File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -705,7 +705,8 @@ static void cleanUpDeadVals(RDVFinalCleanupList &list) {
705705
706706 // 4. Operands
707707 for (auto &o : list.operands ) {
708- o.op ->eraseOperands (o.nonLive );
708+ if (o.nonLive .size () > 0 )
709+ o.op ->eraseOperands (o.nonLive );
709710 }
710711
711712 // 5. Results
Original file line number Diff line number Diff line change @@ -510,3 +510,25 @@ module {
510510// CHECK: %[[yield:.*]] = arith.addf %{{.*}}, %{{.*}} : f32
511511// CHECK: linalg.yield %[[yield]] : f32
512512// CHECK-NOT: arith.subf
513+
514+
515+ // -----
516+
517+ // check that ops with zero operands are correctly handled
518+
519+ module {
520+ func.func @test_zero_operands (%I: memref <10 xindex >, %I2: memref <10 xf32 >) {
521+ %v0 = arith.constant 0 : index
522+ %result = memref.alloca_scope -> index {
523+ %c = arith.addi %v0 , %v0 : index
524+ memref.store %c , %I [%v0 ] : memref <10 xindex >
525+ memref.alloca_scope.return %c: index
526+ }
527+ func.return
528+ }
529+ }
530+
531+ // CHECK-LABEL: func @test_zero_operands
532+ // CHECK: memref.alloca_scope
533+ // CHECK: memref.store
534+ // CHECK-NOT: memref.alloca_scope.return
You can’t perform that action at this time.
0 commit comments