[llvm] [InstCombine] simplify average of lsb (PR #95684)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 16 04:39:55 PDT 2024


================
@@ -1284,6 +1284,14 @@ Instruction *InstCombinerImpl::visitLShr(BinaryOperator &I) {
     return NewSub;
   }
 
+  // Fold (X + Y) / 2 --> (X & Y & 1) iff (X u<= 1) && (Y u<= 1)
----------------
c8ef wrote:

Great catch! The avg-lsb test result is as expected because it needs another `& 1` to clear the high bits.

By the way, I'm not sure why this change is causing the lldb test failure...

```
_bk;t=1718533967352Command Output (stderr):

_bk;t=1718533967352--

_bk;t=1718533967352Traceback (most recent call last):

_bk;t=1718533967352  File "/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-b7x82-1/llvm-project/github-pull-requests/lldb/test/API/dotest.py", line 8, in <module>

_bk;t=1718533967352    lldbsuite.test.run_suite()

_bk;t=1718533967352  File "/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-b7x82-1/llvm-project/github-pull-requests/lldb/packages/Python/lldbsuite/test/dotest.py", line 1045, in run_suite

_bk;t=1718533967352    checkLibcxxSupport()

_bk;t=1718533967352  File "/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-b7x82-1/llvm-project/github-pull-requests/lldb/packages/Python/lldbsuite/test/dotest.py", line 802, in checkLibcxxSupport

_bk;t=1718533967352    result, reason = canRunLibcxxTests()

_bk;t=1718533967352  File "/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-b7x82-1/llvm-project/github-pull-requests/lldb/packages/Python/lldbsuite/test/dotest.py", line 773, in canRunLibcxxTests

_bk;t=1718533967352    from lldbsuite.test import lldbplatformutil

_bk;t=1718533967352  File "/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-b7x82-1/llvm-project/github-pull-requests/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py", line 11, in <module>

_bk;t=1718533967352    from packaging import version

_bk;t=1718533967352ModuleNotFoundError: No module named 'packaging'

_bk;t=1718533967352

_bk;t=1718533967352--

_bk;t=1718533967352

_bk;t=1718533967352********************

_bk;t=1718533967352UNRESOLVED: lldb-api :: lang/objc/warnings-in-expr-parser/TestObjCWarningsInExprParser.py (937 of 2547)

_bk;t=1718533967353******************** TEST 'lldb-api :: lang/objc/warnings-in-expr-parser/TestObjCWarningsInExprParser.py' FAILED ********************
```

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


More information about the llvm-commits mailing list