Skip to content

Commit

Permalink
Add unit tests for the new convergent attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
Diptorup Deb committed Dec 5, 2023
1 parent acffa53 commit fa1fd33
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion llvmlite/tests/test_ir.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,15 @@ def test_declare_attributes(self):
func = self.function()
func.attributes.add("optsize")
func.attributes.add("alwaysinline")
func.attributes.add("convergent")
func.attributes.alignstack = 16
tp_pers = ir.FunctionType(int8, (), var_arg=True)
pers = ir.Function(self.module(), tp_pers, '__gxx_personality_v0')
func.attributes.personality = pers
asm = self.descr(func).strip()
self.assertEqual(asm,
("declare %s alwaysinline optsize alignstack(16) "
("declare %s alwaysinline convergent optsize "
"alignstack(16) "
"personality i8 (...)* @\"__gxx_personality_v0\"") %
self.proto)
# Check pickling
Expand Down Expand Up @@ -1322,6 +1324,7 @@ def test_call(self):
builder.call(f, (a, b), 'res_alwaysinline', attrs='alwaysinline')
builder.call(f, (a, b), 'res_noinline_ro', attrs=('noinline',
'readonly'))
builder.call(f, (a, b), 'res_convergent', attrs='convergent')
self.check_block(block, """\
my_block:
%"res_f" = call float @"f"(i32 %".1", i32 %".2")
Expand All @@ -1334,6 +1337,7 @@ def test_call(self):
%"res_noinline" = call float @"f"(i32 %".1", i32 %".2") noinline
%"res_alwaysinline" = call float @"f"(i32 %".1", i32 %".2") alwaysinline
%"res_noinline_ro" = call float @"f"(i32 %".1", i32 %".2") noinline readonly
%"res_convergent" = call float @"f"(i32 %".1", i32 %".2") convergent
""") # noqa E501

def test_call_metadata(self):
Expand Down

0 comments on commit fa1fd33

Please sign in to comment.