File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
lib/SILOptimizer/SILCombiner Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -1875,19 +1875,16 @@ SILInstruction *SILCombiner::visitSelectEnumInst(SelectEnumInst *SEI) {
1875
1875
}
1876
1876
1877
1877
SILInstruction *SILCombiner::visitTupleExtractInst (TupleExtractInst *TEI) {
1878
- if (TEI->getFunction ()->hasOwnership ())
1879
- return nullptr ;
1880
-
1881
1878
// tuple_extract(apply([add|sub|...]overflow(x, 0)), 1) -> 0
1882
1879
// if it can be proven that no overflow can happen.
1883
- if (TEI->getFieldIndex () != 1 )
1884
- return nullptr ;
1880
+ if (TEI->getFieldIndex () == 1 ) {
1881
+ Builder.setCurrentDebugScope (TEI->getDebugScope ());
1882
+ if (auto *BI = dyn_cast<BuiltinInst>(TEI->getOperand ()))
1883
+ if (!canOverflow (BI))
1884
+ return Builder.createIntegerLiteral (TEI->getLoc (), TEI->getType (),
1885
+ APInt (1 , 0 ));
1886
+ }
1885
1887
1886
- Builder.setCurrentDebugScope (TEI->getDebugScope ());
1887
- if (auto *BI = dyn_cast<BuiltinInst>(TEI->getOperand ()))
1888
- if (!canOverflow (BI))
1889
- return Builder.createIntegerLiteral (TEI->getLoc (), TEI->getType (),
1890
- APInt (1 , 0 ));
1891
1888
return nullptr ;
1892
1889
}
1893
1890
You can’t perform that action at this time.
0 commit comments