[llvm] [X86] Invert (and X, ~(and ~Y, Z)) back into (and X, (or Y, ~Z)) (PR #109215)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 02:00:29 PDT 2024


bgra8 wrote:

@Saldivarcher this patch is causing a huge amount (hundreds) of breakages in our codebase at google. (the compiler enters an infinite loop and never finishes)

Here's a reproducer:

```
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-generic-linux-gnu"

define void @_renamed(i64 %error_code.coerce) #0 {
entry:
  %0 = and i64 %error_code.coerce, 4294967296
  %1 = xor i64 %0, -1
  %2 = and i64 %error_code.coerce, %1
  %3 = icmp eq i64 %2, 0
  br i1 %3, label %5, label %4

4:                                                ; preds = %entry
  unreachable

5:                                                ; preds = %entry
  ret void
}

attributes #0 = { "target-cpu"="haswell" }
```

This compiles in under a second with the previous version and never seems to finish with this patch applied.

Can you please revert while investigating?

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


More information about the llvm-commits mailing list