This is an archive of the discontinued LLVM Phabricator instance.

[mlir][std] Fold comparisons when the operands are equal
ClosedPublic

Authored by herhut on Nov 20 2020, 2:48 AM.

Details

Summary

For equal operands, comparisons can be decided statically.

Diff Detail

Event Timeline

herhut created this revision.Nov 20 2020, 2:48 AM
herhut requested review of this revision.Nov 20 2020, 2:48 AM
rriddle added inline comments.Nov 20 2020, 2:50 AM
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
944

Use BoolAttr here instead.

ftynse accepted this revision.Nov 20 2020, 2:50 AM
ftynse added inline comments.
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
944

BoolAttr(val, getContext()) ?

This revision is now accepted and ready to land.Nov 20 2020, 2:50 AM
frgossen accepted this revision.Nov 20 2020, 2:54 AM

Thanks!

mlir/test/Dialect/Standard/canonicalize.mlir
65

Curious: When do we use CHECK-DAG? I initially thought it is nice to use it when order doesn't matter (like here) and was later told that CHECK is preferable because it is easier to debug.

herhut updated this revision to Diff 306656.Nov 20 2020, 4:10 AM

Comments.

herhut marked 2 inline comments as done.Nov 20 2020, 4:11 AM

Thanks for the reviews!

mlir/test/Dialect/Standard/canonicalize.mlir
65

I have used it here as these two constants are newly added and I did not want to hardwire their order in this test.

This revision was landed with ongoing or failed builds.Nov 20 2020, 4:27 AM
This revision was automatically updated to reflect the committed changes.