This patch is mainly to deal with folding trunci with ext,as flows:
trunci(zexti(a)) -> trunci(a) trunci(sexti(a)) -> trunci(a)
Differential D140604
[MLIR][Arith] Fold trunci with ext if the bit width of the input type of ext is greater than the bit width of the result type of trunci Miss_Grape on Dec 22 2022, 8:32 PM. Authored by
Details This patch is mainly to deal with folding trunci with ext,as flows: trunci(zexti(a)) -> trunci(a) trunci(sexti(a)) -> trunci(a)
Diff Detail
Event TimelineComment Actions Please provide a commit description that explains what you do and, most importantly, why -- https://mlir.llvm.org/getting_started/Contributing/#commit-messages. Also naming nit: the code you are editing is a folding, not a canonicalization.
Comment Actions The commit description still doesn't describe the details of what it is doing and why, only confuses the reader. The code before this commit *was folding trunc(ext)"! This commit does *not* add that. It does, however, *fix* a case that was mishandled. Please find the appropriate way to express that.
Comment Actions The actual comment was not addressed:
|
The following
looks more readable, concise and avoids doing the same thing twice using different APIs (querying the kind of the defining op, getting its operand).