[clang] Fix cir vec cmp fold (PR #202502)

Aayush Shrivastava via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 10 02:59:12 PDT 2026


================
@@ -3475,8 +3501,8 @@ OpFoldResult cir::VecCmpOp::fold(FoldAdaptor adaptor) {
     }
     case cir::CmpOpKind::eq: {
       if (isIntAttr) {
-        cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getSInt() ==
-                    mlir::cast<cir::IntAttr>(rhsAttr).getSInt();
+        cmpResult = mlir::cast<cir::IntAttr>(lhsAttr).getValue() ==
----------------
iamaayushrivastava wrote:

When I added the unsigned-handling for `lt/le/gt/ge`, I touched `eq`/`ne` too for consistency calling `getSInt()` on a possibly-unsigned value felt inconsistent with the new type-aware logic, even though the result is identical either way. Not a correctness fix, just stylistic. Reverted back to `getSInt()` as you suggested, since equality doesn't depend on signedness.

https://github.com/llvm/llvm-project/pull/202502


More information about the cfe-commits mailing list