================
@@ -2479,6 +2479,39 @@ OpFoldResult cir::UnaryOp::fold(FoldAdaptor adaptor) {
if (isBoolNot(previous))
return previous.getInput();
+ // Fold constant unary operations.
+ if (auto srcConst = getInput().getDefiningOp<cir::ConstantOp>()) {
----------------
erichkeane wrote:
I might suggest we do a `TypeSwitch` if we're doing something like that. That
said, WHICH direction we go (switch on kind, then type, vs type then kind)
doesn't seem particularly motivated in 1 way or the other?
https://github.com/llvm/llvm-project/pull/174882
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits