[Optimization] Significantly different assembly output for logically equivalent match patterns with string comparisons #139784
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
A-patterns
Relating to patterns and pattern matching
C-optimization
Category: An issue highlighting optimization opportunities or PRs implementing such
I-slow
Issue: Problems and improvements with respect to performance of generated code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried these codes:
https://godbolt.org/z/c3Ynrcb7j
and:
I expected to see this happen:
Instead, this happened:
There are notable discrepancies in the assembly output between the two functionally equivalent implementations of longest. I suspect that the variant logic in the condition
s1 != "\"" || s2 != ""
may be influencing the compiler's optimization behavior.I’d greatly appreciate it if you could review these cases.
Thank you for your time and consideration!
Meta
The text was updated successfully, but these errors were encountered: