[clang] [CIR] Avoid folding non-integer constants as integer casts (PR #214551)

Akimasa Watanuki via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 10 06:10:00 PDT 2026


================
@@ -212,6 +212,16 @@ module {
   // CHECK-NEXT:   cir.return %[[P]] : !s64i
   // CHECK-NEXT: }
 
+  cir.func @cast_undef() -> !s64i {
+    %0 = cir.const #cir.undef : !s32i
+    %1 = cir.cast integral %0 : !s32i -> !s64i
+    cir.return %1 : !s64i
+  }
+  // CHECK:      @cast_undef
+  // CHECK-NEXT:   %[[U:.+]] = cir.const #cir.undef : !s64i
+  // CHECK-NEXT:   cir.return %[[U]] : !s64i
+  // CHECK-NEXT: }
----------------
Men-cotton wrote:

I think this line doesn't need to be checked. See https://mlir.llvm.org/getting_started/TestingGuide/#contributor-guidelines.
Follow the other points in this guide as well.

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


More information about the cfe-commits mailing list