3) Boolean identity: select c, true, false => c (Safe because we return an existing value; the inverse case `select c, false, true => !c` would require creating an op, so leave that to canonicalization patterns.)
| 5214 | // `select c, false, true => !c` would require creating an op, so leave |
| 5215 | // that to canonicalization patterns.) |
| 5216 | static OpFoldResult tryFoldSelectBoolIdentity(SelectOp op, |
| 5217 | SelectOp::FoldAdaptor adaptor) { |
| 5218 | // select %x, true, false => %x |
| 5219 | Value t = op.getValIfTrue(); |
| 5220 | Value f = op.getValIfFalse(); |
| 5221 | Value cond = op.getCond(); |
| 5222 | auto tileTy = llvm::dyn_cast_or_null<TileType>(op.getType()); |
| 5223 | if (tileTy && tileTy.getElementType().isSignlessInteger(1) && |
| 5224 | isConstantTrueVal(t) && isConstantFalseVal(f)) |
| 5225 | return cond; |
| 5226 | return {}; |
| 5227 | } |
| 5228 | |
| 5229 | static OpFoldResult tryFoldSelectWithCmp(SelectOp op, |
| 5230 | SelectOp::FoldAdaptor adaptor) { |
nothing calls this directly
no test coverage detected