gemini-code-assist[bot] commented on code in PR #19716:
URL: https://github.com/apache/tvm/pull/19716#discussion_r3386248463


##########
tests/python/codegen/test_target_codegen_llvm_vla.py:
##########
@@ -109,9 +109,13 @@ def my_func(a: T.handle):
         mod = tvm.tirx.build(my_func)
 
     llvm = mod.inspect_source("ll")
+    # Older LLVM versions print the broadcast as a shufflevector of an 
insertelement,
+    # newer ones print it as a splat constant.
     assert re.findall(
         r"shufflevector \(<vscale x 4 x float> insertelement \(<vscale x 4 x 
float>", llvm
-    ), "No scalable broadcast in generated LLVM."
+    ) or re.findall(r"store <vscale x 4 x float> splat \(float 
1\.000000e\+00\)", llvm), (
+        "No scalable broadcast in generated LLVM."
+    )

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Since both patterns are literal strings without any dynamic regex patterns 
(like wildcards or character classes), we can use the Python `in` operator 
instead of `re.findall`. This is more readable, avoids the need to escape 
parentheses and dots, and is significantly more efficient.
   
   ```python
       assert (
           "shufflevector (<vscale x 4 x float> insertelement (<vscale x 4 x 
float>" in llvm
           or "store <vscale x 4 x float> splat (float 1.000000e+00)" in llvm
       ), "No scalable broadcast in generated LLVM."
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to