[flang-commits] [flang] [flang] Use __builtin_int for integer conversions (PR #195748)

via flang-commits flang-commits at lists.llvm.org
Mon May 4 14:59:10 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-parser

Author: Leandro Lupori (luporl)

<details>
<summary>Changes</summary>

Frontend inserted conversions may conflict with variable names.
Avoid this for integer conversions by using `__builtin_int` instead
of `int`.

Fixes #<!-- -->188879


---

Patch is 43.52 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/195748.diff


33 Files Affected:

- (modified) flang/lib/Evaluate/formatting.cpp (+3-3) 
- (modified) flang/lib/Evaluate/intrinsics.cpp (+1) 
- (modified) flang/test/Evaluate/bug153031.f90 (+2-2) 
- (added) flang/test/Evaluate/bug188879.f90 (+9) 
- (modified) flang/test/Evaluate/elem-shape.f90 (+1-1) 
- (modified) flang/test/Evaluate/fold-assumed-type-rank.f90 (+1-1) 
- (modified) flang/test/Evaluate/rewrite01.f90 (+10-10) 
- (modified) flang/test/Evaluate/rewrite02.f90 (+12-12) 
- (modified) flang/test/Evaluate/rewrite05.f90 (+3-3) 
- (modified) flang/test/Parser/OpenMP/doacross-clause.f90 (+2-2) 
- (modified) flang/test/Parser/OpenMP/loop-transformation-construct01.f90 (+5-5) 
- (modified) flang/test/Parser/OpenMP/loop-transformation-construct02.f90 (+5-5) 
- (modified) flang/test/Parser/OpenMP/loop-transformation-construct03.f90 (+4-4) 
- (modified) flang/test/Parser/OpenMP/ordered-depend.f90 (+2-2) 
- (modified) flang/test/Parser/cuf-sanity-unparse.CUF (+3-3) 
- (modified) flang/test/Semantics/array-constr-values.f90 (+1-1) 
- (modified) flang/test/Semantics/bug124716.f90 (+2-2) 
- (modified) flang/test/Semantics/call03.f90 (+4-4) 
- (modified) flang/test/Semantics/call22.f90 (+1-1) 
- (modified) flang/test/Semantics/data01.f90 (+1-1) 
- (modified) flang/test/Semantics/lshift.f90 (+4-4) 
- (modified) flang/test/Semantics/modfile03.f90 (+2-2) 
- (modified) flang/test/Semantics/modfile17.f90 (+8-8) 
- (modified) flang/test/Semantics/modfile23.f90 (+1-1) 
- (modified) flang/test/Semantics/modfile33.f90 (+2-2) 
- (modified) flang/test/Semantics/modfile39.f90 (+1-1) 
- (modified) flang/test/Semantics/modfile48.f90 (+1-1) 
- (modified) flang/test/Semantics/modproc01.f90 (+31-31) 
- (modified) flang/test/Semantics/pdt04.f90 (+1-1) 
- (modified) flang/test/Semantics/rewrite03.f90 (+5-5) 
- (modified) flang/test/Semantics/rshift.f90 (+4-4) 
- (modified) flang/test/Semantics/symbol17.f90 (+2-2) 
- (modified) flang/test/Semantics/type-parameter-constant.f90 (+1-1) 


``````````diff
diff --git a/flang/lib/Evaluate/formatting.cpp b/flang/lib/Evaluate/formatting.cpp
index 09cb8b08dda81..f62b374a3c604 100644
--- a/flang/lib/Evaluate/formatting.cpp
+++ b/flang/lib/Evaluate/formatting.cpp
@@ -510,7 +510,7 @@ llvm::raw_ostream &Convert<TO, FROMCAT>::AsFortran(llvm::raw_ostream &o) const {
   if constexpr (TO::category == TypeCategory::Character) {
     this->left().AsFortran(o << "achar(iachar(") << ')';
   } else if constexpr (TO::category == TypeCategory::Integer) {
-    this->left().AsFortran(o << "int(");
+    this->left().AsFortran(o << "__builtin_int(");
   } else if constexpr (TO::category == TypeCategory::Real) {
     this->left().AsFortran(o << "real(");
   } else if constexpr (TO::category == TypeCategory::Complex) {
@@ -828,10 +828,10 @@ llvm::raw_ostream &DescriptorInquiry::AsFortran(llvm::raw_ostream &o) const {
     o << "%STRIDE(";
     break;
   case Field::Rank:
-    o << "int(rank(";
+    o << "__builtin_int(rank(";
     break;
   case Field::Len:
-    o << "int(";
+    o << "__builtin_int(";
     break;
   }
   base_.AsFortran(o);
diff --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp
index 84cd2288fcd0b..1027eb9db3c66 100644
--- a/flang/lib/Evaluate/intrinsics.cpp
+++ b/flang/lib/Evaluate/intrinsics.cpp
@@ -1185,6 +1185,7 @@ static const std::pair<const char *, const char *> genericAlias[]{
     {"unsigned", "uint"}, // Sun vs gfortran names
     {"xor", "ieor"},
     {"__builtin_ieee_selected_real_kind", "selected_real_kind"},
+    {"__builtin_int", "int"},
 };
 
 // The following table contains the intrinsic functions listed in
diff --git a/flang/test/Evaluate/bug153031.f90 b/flang/test/Evaluate/bug153031.f90
index a717954ecaed1..b37088d15c84d 100644
--- a/flang/test/Evaluate/bug153031.f90
+++ b/flang/test/Evaluate/bug153031.f90
@@ -11,8 +11,8 @@ pure integer function pure(n)
 end interface
 type(t) :: x(10)
 allocate(x(1)%a(2))
-!CHECK: PRINT *, ubound(x(int(impure(1_4),kind=8))%a,dim=1_4)
+!CHECK: PRINT *, ubound(x(__builtin_int(impure(1_4),kind=8))%a,dim=1_4)
 print *, ubound(x(impure(1))%a, dim=1)
-!CHECK: PRINT *, int(size(x(int(pure(1_4),kind=8))%a,dim=1,kind=8)+lbound(x(int(pure(1_4),kind=8))%a,dim=1,kind=8)-1_8,kind=4)
+!CHECK: PRINT *, __builtin_int(size(x(__builtin_int(pure(1_4),kind=8))%a,dim=1,kind=8)+lbound(x(__builtin_int(pure(1_4),kind=8))%a,dim=1,kind=8)-1_8,kind=4)
 print *, ubound(x(pure(1))%a, dim=1)
 end
diff --git a/flang/test/Evaluate/bug188879.f90 b/flang/test/Evaluate/bug188879.f90
new file mode 100644
index 0000000000000..ba2315f85ce56
--- /dev/null
+++ b/flang/test/Evaluate/bug188879.f90
@@ -0,0 +1,9 @@
+! RUN: %flang_fc1 -fdebug-dump-symbols %s 2>&1 | FileCheck %s
+! Ensure that integer conversions inserted by the frontend use __builtin_int.
+
+subroutine sub0 (n, int )
+  integer(kind=4) :: n
+  !CHECK: Subprogram scope: sub0
+  !CHECK:   int {{.*}}: ObjectEntity dummy type: INTEGER(4) shape: 1_8:__builtin_int(n,kind=8)
+  integer(kind=4) :: int(n)
+end subroutine
diff --git a/flang/test/Evaluate/elem-shape.f90 b/flang/test/Evaluate/elem-shape.f90
index 623c833274cb3..8445898e9b0db 100644
--- a/flang/test/Evaluate/elem-shape.f90
+++ b/flang/test/Evaluate/elem-shape.f90
@@ -5,7 +5,7 @@ module m
   subroutine sub(x,y)
     real :: x(:), y(:)
     optional x
-    !CHECK: PRINT *, int(size(y,dim=1,kind=8),kind=4)
+    !CHECK: PRINT *, __builtin_int(size(y,dim=1,kind=8),kind=4)
     print *, size(f(x,y))
   end
   elemental function f(x,y)
diff --git a/flang/test/Evaluate/fold-assumed-type-rank.f90 b/flang/test/Evaluate/fold-assumed-type-rank.f90
index ce296c8e27abf..59387df6d30e1 100644
--- a/flang/test/Evaluate/fold-assumed-type-rank.f90
+++ b/flang/test/Evaluate/fold-assumed-type-rank.f90
@@ -1,6 +1,6 @@
 ! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s
 subroutine sub3(ar_at)
   type(*) :: ar_at(..)
-!CHECK:  PRINT *, int(int(rank(ar_at),kind=8),kind=4)
+!CHECK:  PRINT *, __builtin_int(__builtin_int(rank(ar_at),kind=8),kind=4)
   print *, rank(ar_at)
 end
diff --git a/flang/test/Evaluate/rewrite01.f90 b/flang/test/Evaluate/rewrite01.f90
index fbbf051246ffe..6dd8bf85cacf7 100644
--- a/flang/test/Evaluate/rewrite01.f90
+++ b/flang/test/Evaluate/rewrite01.f90
@@ -26,7 +26,7 @@ function returns_array_3()
 subroutine ubound_test(x, n, m)
   integer :: x(n, m)
   integer :: y(0:n, 0:m) ! UBOUND could be 0 if n or m are < 0
-  !CHECK: PRINT *, [INTEGER(4)::int(size(x,dim=1,kind=8),kind=4),int(size(x,dim=2,kind=8),kind=4)]
+  !CHECK: PRINT *, [INTEGER(4)::__builtin_int(size(x,dim=1,kind=8),kind=4),__builtin_int(size(x,dim=2,kind=8),kind=4)]
   print *, ubound(x)
   !CHECK: PRINT *, ubound(returns_array(n,m))
   print *, ubound(returns_array(n, m))
@@ -44,7 +44,7 @@ subroutine ubound_test(x, n, m)
 
 subroutine size_test(x, n, m)
   integer :: x(n, m)
-  !CHECK: PRINT *, int(size(x,dim=1,kind=8)*size(x,dim=2,kind=8),kind=4)
+  !CHECK: PRINT *, __builtin_int(size(x,dim=1,kind=8)*size(x,dim=2,kind=8),kind=4)
   print *, size(x)
   !CHECK: PRINT *, size(returns_array(n,m))
   print *, size(returns_array(n, m))
@@ -65,7 +65,7 @@ function foo(n)
   end interface
   procedure(foo), pointer :: pf
   integer :: x(n, m)
-  !CHECK: PRINT *, [INTEGER(4)::int(size(x,dim=1,kind=8),kind=4),int(size(x,dim=2,kind=8),kind=4)]
+  !CHECK: PRINT *, [INTEGER(4)::__builtin_int(size(x,dim=1,kind=8),kind=4),__builtin_int(size(x,dim=2,kind=8),kind=4)]
   print *, shape(x)
   !CHECK: PRINT *, shape(returns_array(n,m))
   print *, shape(returns_array(n, m))
@@ -126,7 +126,7 @@ function mofun(L)
      end function mofun
   end interface
 
-  !CHECK: PRINT *, int(int(a%len,kind=8),kind=4)
+  !CHECK: PRINT *, __builtin_int(__builtin_int(a%len,kind=8),kind=4)
   print *, len(a)
   !CHECK: PRINT *, 5_4
   print *, len(a(1:5))
@@ -136,7 +136,7 @@ end function mofun
   print *, len(b(a) // a)
   !CHECK: PRINT *, 10_4
   print *, len(c)
-  !CHECK: PRINT *, len(c(int(i,kind=8):int(j,kind=8)))
+  !CHECK: PRINT *, len(c(__builtin_int(i,kind=8):__builtin_int(j,kind=8)))
   print *, len(c(i:j))
   !CHECK: PRINT *, 5_4
   print *, len(c(1:5))
@@ -146,11 +146,11 @@ end function mofun
   print *, len(d(c) // c)
   !CHECK: PRINT *, 0_4
   print *, len(a(10:4))
-  !CHECK: PRINT *, int(max(0_8,int(m,kind=8)-int(n,kind=8)+1_8),kind=4)
+  !CHECK: PRINT *, __builtin_int(max(0_8,__builtin_int(m,kind=8)-__builtin_int(n,kind=8)+1_8),kind=4)
   print *, len(a(n:m))
-  !CHECK: PRINT *, len(b(a(int(n,kind=8):int(m,kind=8))))
+  !CHECK: PRINT *, len(b(a(__builtin_int(n,kind=8):__builtin_int(m,kind=8))))
   print *, len(b(a(n:m)))
-  !CHECK: PRINT *, int(max(0_8,max(0_8,int(n,kind=8))-4_8+1_8),kind=4)
+  !CHECK: PRINT *, __builtin_int(max(0_8,max(0_8,__builtin_int(n,kind=8))-4_8+1_8),kind=4)
   print *, len(e(4:))
   !CHECK: PRINT *, len(fun1(n-m))
   print *, len(fun1(n-m))
@@ -162,7 +162,7 @@ end function mofun
   print *, len(trim(c))
   !CHECK: PRINT *, 40_4
   print *, len(repeat(c, 4))
-  !CHECK: PRINT *, len(repeat(c,int(i,kind=8)))
+  !CHECK: PRINT *, len(repeat(c,__builtin_int(i,kind=8)))
   print *, len(repeat(c, i))
 end subroutine len_test
 
@@ -237,7 +237,7 @@ subroutine array_ctor_implied_do_index(x, j)
   character(10) :: c
   !CHECK: PRINT *, size([INTEGER(4)::(x(1_8:i:1_8),INTEGER(8)::i=1_8,2_8,1_8)])
   print *, size([(x(1:i), integer(8)::i=1,2)])
-  !CHECK: PRINT *, int(2_8*max((j-1_8+1_8)/1_8,0_8),kind=4)
+  !CHECK: PRINT *, __builtin_int(2_8*max((j-1_8+1_8)/1_8,0_8),kind=4)
   print *, size([(x(1:j), integer(8)::i=1,2)])
   !CHECK: PRINT *, len([(c(i:i),INTEGER(8)::i=1_8,4_8,1_8)])
   print *, len([(c(i:i), integer(8)::i = 1,4)])
diff --git a/flang/test/Evaluate/rewrite02.f90 b/flang/test/Evaluate/rewrite02.f90
index e1eebe55134e5..f6b4246684c4c 100644
--- a/flang/test/Evaluate/rewrite02.f90
+++ b/flang/test/Evaluate/rewrite02.f90
@@ -8,17 +8,17 @@ subroutine foo(j)
     character*4 sc, ac(1)
   end type
   type(t) st, at(1)
-  !CHECK: PRINT *, sc(1_8:int(j,kind=8))
+  !CHECK: PRINT *, sc(1_8:__builtin_int(j,kind=8))
   print *, sc(1:j)
-  !CHECK: PRINT *, ac(1_8)(1_8:int(j,kind=8))
+  !CHECK: PRINT *, ac(1_8)(1_8:__builtin_int(j,kind=8))
   print *, ac(1)(1:j)
-  !CHECK: PRINT *, st%sc(1_8:int(j,kind=8))
+  !CHECK: PRINT *, st%sc(1_8:__builtin_int(j,kind=8))
   print *, st%sc(1:j)
-  !CHECK: PRINT *, st%ac(1_8)(1_8:int(j,kind=8))
+  !CHECK: PRINT *, st%ac(1_8)(1_8:__builtin_int(j,kind=8))
   print *, st%ac(1)(1:j)
-  !CHECK: PRINT *, at(1_8)%sc(1_8:int(j,kind=8))
+  !CHECK: PRINT *, at(1_8)%sc(1_8:__builtin_int(j,kind=8))
   print *, at(1)%sc(1:j)
-  !CHECK: PRINT *, at(1_8)%ac(1_8)(1_8:int(j,kind=8))
+  !CHECK: PRINT *, at(1_8)%ac(1_8)(1_8:__builtin_int(j,kind=8))
   print *, at(1)%ac(1)(1:j)
   !CHECK: PRINT *, 1_4
   print *, sc(1:j)%kind
@@ -32,16 +32,16 @@ subroutine foo(j)
   print *, at(1)%sc(1:j)%kind
   !CHECK: PRINT *, 1_4
   print *, at(1)%ac(1)(1:j)%kind
-  !CHECK: PRINT *, int(max(0_8,int(j,kind=8)-1_8+1_8),kind=4)
+  !CHECK: PRINT *, __builtin_int(max(0_8,__builtin_int(j,kind=8)-1_8+1_8),kind=4)
   print *, sc(1:j)%len
-  !CHECK: PRINT *, int(max(0_8,int(j,kind=8)-1_8+1_8),kind=4)
+  !CHECK: PRINT *, __builtin_int(max(0_8,__builtin_int(j,kind=8)-1_8+1_8),kind=4)
   print *, ac(1)(1:j)%len
-  !CHECK: PRINT *, int(max(0_8,int(j,kind=8)-1_8+1_8),kind=4)
+  !CHECK: PRINT *, __builtin_int(max(0_8,__builtin_int(j,kind=8)-1_8+1_8),kind=4)
   print *, st%sc(1:j)%len
-  !CHECK: PRINT *, int(max(0_8,int(j,kind=8)-1_8+1_8),kind=4)
+  !CHECK: PRINT *, __builtin_int(max(0_8,__builtin_int(j,kind=8)-1_8+1_8),kind=4)
   print *, st%ac(1)(1:j)%len
-  !CHECK: PRINT *, int(max(0_8,int(j,kind=8)-1_8+1_8),kind=4)
+  !CHECK: PRINT *, __builtin_int(max(0_8,__builtin_int(j,kind=8)-1_8+1_8),kind=4)
   print *, at(1)%sc(1:j)%len
-  !CHECK: PRINT *, int(max(0_8,int(j,kind=8)-1_8+1_8),kind=4)
+  !CHECK: PRINT *, __builtin_int(max(0_8,__builtin_int(j,kind=8)-1_8+1_8),kind=4)
   print *, at(1)%ac(1)(1:j)%len
 end
diff --git a/flang/test/Evaluate/rewrite05.f90 b/flang/test/Evaluate/rewrite05.f90
index f81974f24fd97..15b13a432f459 100644
--- a/flang/test/Evaluate/rewrite05.f90
+++ b/flang/test/Evaluate/rewrite05.f90
@@ -5,11 +5,11 @@ program main
   end type
   type(t) :: x
   call init(10)
-  !CHECK: PRINT *, [INTEGER(4)::int(lbound(x%component,dim=1,kind=8),kind=4)]
+  !CHECK: PRINT *, [INTEGER(4)::__builtin_int(lbound(x%component,dim=1,kind=8),kind=4)]
   print *, lbound(x%component)
-  !CHECK: PRINT *, [INTEGER(4)::int(size(x%component,dim=1,kind=8)+lbound(x%component,dim=1,kind=8)-1_8,kind=4)]
+  !CHECK: PRINT *, [INTEGER(4)::__builtin_int(size(x%component,dim=1,kind=8)+lbound(x%component,dim=1,kind=8)-1_8,kind=4)]
   print *, ubound(x%component)
-  !CHECK: PRINT *, int(size(x%component,dim=1,kind=8),kind=4)
+  !CHECK: PRINT *, __builtin_int(size(x%component,dim=1,kind=8),kind=4)
   print *, size(x%component)
   !CHECK: PRINT *, 4_8*size(x%component,dim=1,kind=8)
   print *, sizeof(x%component)
diff --git a/flang/test/Parser/OpenMP/doacross-clause.f90 b/flang/test/Parser/OpenMP/doacross-clause.f90
index 28245630d0361..80a97db248cb1 100644
--- a/flang/test/Parser/OpenMP/doacross-clause.f90
+++ b/flang/test/Parser/OpenMP/doacross-clause.f90
@@ -19,7 +19,7 @@ subroutine f00(x)
 !UNPARSE:  DO i=1_4,10_4
 !UNPARSE:   DO j=1_4,10_4
 !UNPARSE: !$OMP ORDERED  DOACROSS(SOURCE)
-!UNPARSE:     x(int(i,kind=8),int(j,kind=8))=i+j
+!UNPARSE:     x(__builtin_int(i,kind=8),__builtin_int(j,kind=8))=i+j
 !UNPARSE:   END DO
 !UNPARSE:  END DO
 !UNPARSE: !$OMP END DO
@@ -53,7 +53,7 @@ subroutine f01(x)
 !UNPARSE:  DO i=1_4,10_4
 !UNPARSE:   DO j=1_4,10_4
 !UNPARSE: !$OMP ORDERED  DOACROSS(SINK: i+1_4, j-2_4) DOACROSS(SINK: i, j+3_4)
-!UNPARSE:     x(int(i,kind=8),int(j,kind=8))=i+j
+!UNPARSE:     x(__builtin_int(i,kind=8),__builtin_int(j,kind=8))=i+j
 !UNPARSE:   END DO
 !UNPARSE:  END DO
 !UNPARSE: !$OMP END DO
diff --git a/flang/test/Parser/OpenMP/loop-transformation-construct01.f90 b/flang/test/Parser/OpenMP/loop-transformation-construct01.f90
index e4f2e1810dc3a..1d24f7b33e31d 100644
--- a/flang/test/Parser/OpenMP/loop-transformation-construct01.f90
+++ b/flang/test/Parser/OpenMP/loop-transformation-construct01.f90
@@ -41,15 +41,15 @@ subroutine loop_transformation_construct
 !CHECK-PARSE-NEXT: | | | | | | | | | Scalar -> Expr = 'i'
 !CHECK-PARSE-NEXT: | | | | | | | | | | Designator -> DataRef -> Name = 'i'
 !CHECK-PARSE-NEXT: | | | | | | | Block
-!CHECK-PARSE-NEXT: | | | | | | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'y(int(i,kind=8))=5_4*y(int(i,kind=8))'
-!CHECK-PARSE-NEXT: | | | | | | | | | Variable = 'y(int(i,kind=8))'
+!CHECK-PARSE-NEXT: | | | | | | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'y(__builtin_int(i,kind=8))=5_4*y(__builtin_int(i,kind=8))'
+!CHECK-PARSE-NEXT: | | | | | | | | | Variable = 'y(__builtin_int(i,kind=8))'
 !CHECK-PARSE-NEXT: | | | | | | | | | | Designator -> DataRef -> ArrayElement
 !CHECK-PARSE-NEXT: | | | | | | | | | | | DataRef -> Name = 'y'
 !CHECK-PARSE-NEXT: | | | | | | | | | | | SectionSubscript -> Integer -> Expr = 'i'
 !CHECK-PARSE-NEXT: | | | | | | | | | | | | Designator -> DataRef -> Name = 'i'
-!CHECK-PARSE-NEXT: | | | | | | | | | Expr = '5_4*y(int(i,kind=8))'
+!CHECK-PARSE-NEXT: | | | | | | | | | Expr = '5_4*y(__builtin_int(i,kind=8))'
 !CHECK-PARSE-NEXT: | | | | | | | | | | Multiply
-!CHECK-PARSE-NEXT: | | | | | | | | | | | Expr = 'y(int(i,kind=8))'
+!CHECK-PARSE-NEXT: | | | | | | | | | | | Expr = 'y(__builtin_int(i,kind=8))'
 !CHECK-PARSE-NEXT: | | | | | | | | | | | | Designator -> DataRef -> ArrayElement
 !CHECK-PARSE-NEXT: | | | | | | | | | | | | | DataRef -> Name = 'y'
 !CHECK-PARSE-NEXT: | | | | | | | | | | | | | SectionSubscript -> Integer -> Expr = 'i'
@@ -74,7 +74,7 @@ subroutine loop_transformation_construct
 !CHECK-UNPARSE-NEXT: !$OMP DO
 !CHECK-UNPARSE-NEXT: !$OMP UNROLL PARTIAL(1_4)
 !CHECK-UNPARSE-NEXT:  DO i=1_4,i
-!CHECK-UNPARSE-NEXT:    y(int(i,kind=8))=5_4*y(int(i,kind=8))
+!CHECK-UNPARSE-NEXT:    y(__builtin_int(i,kind=8))=5_4*y(__builtin_int(i,kind=8))
 !CHECK-UNPARSE-NEXT:  END DO
 !CHECK-UNPARSE-NEXT: !$OMP END UNROLL
 !CHECK-UNPARSE-NEXT: !$OMP END DO
diff --git a/flang/test/Parser/OpenMP/loop-transformation-construct02.f90 b/flang/test/Parser/OpenMP/loop-transformation-construct02.f90
index 460c4895d9ecc..0d4fce64a2369 100644
--- a/flang/test/Parser/OpenMP/loop-transformation-construct02.f90
+++ b/flang/test/Parser/OpenMP/loop-transformation-construct02.f90
@@ -50,15 +50,15 @@ subroutine loop_transformation_construct
 !CHECK-PARSE-NEXT: | | | | | | | | | | | Scalar -> Expr = 'i'
 !CHECK-PARSE-NEXT: | | | | | | | | | | | | Designator -> DataRef -> Name = 'i'
 !CHECK-PARSE-NEXT: | | | | | | | | | Block
-!CHECK-PARSE-NEXT: | | | | | | | | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'y(int(i,kind=8))=5_4*y(int(i,kind=8))'
-!CHECK-PARSE-NEXT: | | | | | | | | | | | Variable = 'y(int(i,kind=8))'
+!CHECK-PARSE-NEXT: | | | | | | | | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'y(__builtin_int(i,kind=8))=5_4*y(__builtin_int(i,kind=8))'
+!CHECK-PARSE-NEXT: | | | | | | | | | | | Variable = 'y(__builtin_int(i,kind=8))'
 !CHECK-PARSE-NEXT: | | | | | | | | | | | | Designator -> DataRef -> ArrayElement
 !CHECK-PARSE-NEXT: | | | | | | | | | | | | | DataRef -> Name = 'y'
 !CHECK-PARSE-NEXT: | | | | | | | | | | | | | SectionSubscript -> Integer -> Expr = 'i'
 !CHECK-PARSE-NEXT: | | | | | | | | | | | | | | Designator -> DataRef -> Name = 'i'
-!CHECK-PARSE-NEXT: | | | | | | | | | | | Expr = '5_4*y(int(i,kind=8))'
+!CHECK-PARSE-NEXT: | | | | | | | | | | | Expr = '5_4*y(__builtin_int(i,kind=8))'
 !CHECK-PARSE-NEXT: | | | | | | | | | | | | Multiply
-!CHECK-PARSE-NEXT: | | | | | | | | | | | | | Expr = 'y(int(i,kind=8))'
+!CHECK-PARSE-NEXT: | | | | | | | | | | | | | Expr = 'y(__builtin_int(i,kind=8))'
 !CHECK-PARSE-NEXT: | | | | | | | | | | | | | | Designator -> DataRef -> ArrayElement
 !CHECK-PARSE-NEXT: | | | | | | | | | | | | | | | DataRef -> Name = 'y'
 !CHECK-PARSE-NEXT: | | | | | | | | | | | | | | | SectionSubscript -> Integer -> Expr = 'i'
@@ -88,7 +88,7 @@ subroutine loop_transformation_construct
 !CHECK-UNPARSE-NEXT: !$OMP UNROLL PARTIAL(1_4)
 !CHECK-UNPARSE-NEXT: !$OMP TILE
 !CHECK-UNPARSE-NEXT:  DO i=1_4,i
-!CHECK-UNPARSE-NEXT:    y(int(i,kind=8))=5_4*y(int(i,kind=8))
+!CHECK-UNPARSE-NEXT:    y(__builtin_int(i,kind=8))=5_4*y(__builtin_int(i,kind=8))
 !CHECK-UNPARSE-NEXT:  END DO
 !CHECK-UNPARSE-NEXT: !$OMP END TILE
 !CHECK-UNPARSE-NEXT: !$OMP END UNROLL
diff --git a/flang/test/Parser/OpenMP/loop-transformation-construct03.f90 b/flang/test/Parser/OpenMP/loop-transformation-construct03.f90
index 0c94b21d48239..db90b395eb0d7 100644
--- a/flang/test/Parser/OpenMP/loop-transformation-construct03.f90
+++ b/flang/test/Parser/OpenMP/loop-transformation-construct03.f90
@@ -45,15 +45,15 @@ subroutine loop_transformation_construct7
 !CHECK-PARSE-NEXT: | | | | | | | | | Scalar -> Expr = '10_4'
 !CHECK-PARSE-NEXT: | | | | | | | | | | LiteralConstant -> IntLiteralConstant = '10'
 !CHECK-PARSE-NEXT: | | | | | | | Block
-!CHECK-PARSE-NEXT: | | | | | | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'a(int(b,kind=8),2_8)=a(int(c,kind=8),1_8)'
-!CHECK-PARSE-NEXT: | | | | | | | | | Variable = 'a(int(b,kind=8),2_8)'
+!CHECK-PARSE-NEXT: | | | | | | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'a(__builtin_int(b,kind=8),2_8)=a(__builtin_int(c,kind=8),1_8)'
+!CHECK-PARSE-NEXT: | | | | | | | | | Variable = 'a(__builtin_int(b,kind=8),2_8)'
 !CHECK-PARSE-NEXT: | | | | | | | | | | Designator -> DataRef -> ArrayElement
 !CHECK-PARSE-NEXT: | | | | | | | | | | | DataRef -> Name = 'a'
 !CHECK-PARSE-NEXT: | | | | | | | | | | | SectionSubscript -> Integer -> Expr = 'b'
 !CHECK-PARSE-NEXT: | | | | | | | | | | | | Designator -> DataRef -> Name = 'b'
 !CHECK-PARSE-NEXT: | | | | | | | | | | | SectionSubscript -> Integer -> Expr = '2_4'
 !CHECK-PARSE-NEXT: | | | | | | | | | | | | LiteralConstant -> IntLiteralConstant = '2'
-!CHECK-PARSE-NEXT: | | | | | | | | | Expr = 'a(int(c,kind=8),1_8)'
+!CHECK-PARSE-NEXT: | | | | | | | | | Expr = 'a(__builtin_int(c,kind=8),1_8)'
 !CHECK-PARSE-NEXT: | | | | | | | | | | Designator -> DataRef -> ArrayElement
 !CHECK-PARSE-NEXT: | | | | | | | | | | | DataRef -> Name = 'a'
 !CHECK-PARSE-NEXT: | | | | | | | | | | | SectionSubscript -> Integer -> Expr = 'c'
@@ -71,7 +71,7 @@ subroutine loop_transformation_construct7
 !CHECK-UNPARSE-NEXT: !$OMP TARGET TEAMS DISTRIBUTE PARALLEL DO  COLLAPSE(2_4) PRIVATE(b)
 !CHECK-UNPARSE-NEXT:  DO b=1_4,10_4
 !CHECK-UNPARSE-NEXT:   DO c=1_4,10_4
-!CHECK-UNPARSE-NEXT:     a(int(b,kind=8),2_8)=a(int(c,kind=8),1_8)
+!CHECK-UNPARSE-NEXT:     a(__builtin_int(b,kind=8),2_8)=a(__builtin_int(c,kind=8),1_8)
 !CHECK-UNPARSE-NEXT:   END DO
 !CHECK-UNPARSE-NEXT:  END DO
 !CHECK-UNPARSE-NEXT: END SUBROUTINE
diff --git a/flang/test/Parser/OpenMP/ordered-depend.f90 b/flang/test/Parser/OpenMP/ordered-depend.f90
index aa2ef044f4c20..d937273ae8e1b 100644
--- a/flang/test/Parser/OpenMP/ordered-depend.f90
+++ b/flang/test/Parser/OpenMP/ordered-depend.f90
@@ -19,7 +19,7 @@ subroutine f00(x)
 !UNPARSE:  DO i=1_4,10_4
 !UNPARSE:   DO j=1_4,10_4
 !UNPARSE: !$OMP ORDERED  DEPEND(SOURCE)
-!UNPARSE:     x(int(i,kind=8),int(j,kind=8))=i+j
+!UNPARSE:     x(__builtin_int(i,kind=8),__builtin_int(j,kind=8))=i+j
 !UNPARSE:   END DO
 !UNPARSE:  END DO
 !UNPARSE: !$OMP END DO
@@ -53,7 +53,7 @@ subroutine f01(x)
 !UNPARSE:  DO i=1_4,10_4
 !UNPARSE:   DO j=1_4,10_4
 !UNPARSE: !$OMP ORDERED  DEPEND(SINK: i+1_4, j-2_4) DEPEND(SINK: i, j+3_4)
-!UNPARSE:     x(int(i,kind=8),int(j,kind=8))=i+j
+!UNPARSE:     x(__builtin_int(i,kind=8),__builtin_int(j,kind=8))=i+j
 !UNPARSE:   END DO
 !UNPARSE:  END DO
 !UNPARSE: !$OMP END DO
diff --git a/flang/test/Parser/cuf-sanity-unparse.CUF b/flang/test/Parser/cuf-sanity-unparse.CUF
index ede98093c442d..7bf4833a56fb8 100644
--- a/flang/test/Parser/cuf-sanity-unparse.CUF
+++ b/flang/test/Parser/cuf-sanity-unparse.CUF
@@ -36,9 +36,9 @@ include "cuf-sanity-common"
 !CHECK:   END DO
 !CHECK:   !$CUF KERNEL DO <<<*,*>>> REDUCE(+:x,y) REDUCE(*:z)
 !CHECK:   DO j=1_4,10_4
-!CHECK:    x=x+a(int(j,kind=8))
-!CHECK:    y=y+a(int(j,kind=8))
-!CHECK:    z=z*a(int(j,kind=8))
+!CHECK:    x=x+a(__builtin_int(j,kind=8))
+!CHECK:    y=y+a(__builtin_int(j,kind=8))
+!CHE...
[truncated]

``````````

</details>


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


More information about the flang-commits mailing list