Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in CIRIfFlatten when if clause #1090

Open
orbiri opened this issue Nov 8, 2024 · 0 comments
Open

Crash in CIRIfFlatten when if clause #1090

orbiri opened this issue Nov 8, 2024 · 0 comments

Comments

@orbiri
Copy link
Contributor

orbiri commented Nov 8, 2024

When trying to debug why this reduced snippet from SingleSource fails:

extern void link_error1();

void test4(float x, float y) {
  if ((x == y) || (x != y)) {
  } else
    link_error1();
}

With this crash

Assertion failed: (!NodePtr->isKnownSentinel()), function operator*, file ilist_iterator.h, line 168.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /Users/orbiri/cir/llvm-project/build/Release/bin/cir-opt --mlir-print-ir-after-failure --cir-to-llvm --reconcile-unrealized-casts /tmp/test.cir -o /tmp/test.mlir
 #0 0x0000000107267a28 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/Users/orbiri/cir/llvm-project/build/Release/bin/cir-opt+0x101418a28)
 #1 0x0000000107265929 llvm::sys::RunSignalHandlers() (/Users/orbiri/cir/llvm-project/build/Release/bin/cir-opt+0x101416929)
 #2 0x0000000107268096 SignalHandler(int) (/Users/orbiri/cir/llvm-project/build/Release/bin/cir-opt+0x101419096)
 #3 0x00007ff812efce9d (/usr/lib/system/libsystem_platform.dylib+0x7ff80047fe9d)
 #4 0x00007ff7ba0af3f0 
 #5 0x00007ff812de8b19 (/usr/lib/system/libsystem_c.dylib+0x7ff80036bb19)
 #6 0x00007ff812de7ddc (/usr/lib/system/libsystem_c.dylib+0x7ff80036addc)
 #7 0x00000001074d1d93 (anonymous namespace)::CIRIfFlattening::matchAndRewrite(mlir::cir::IfOp, mlir::PatternRewriter&) const (.cold.14) (/Users/orbiri/cir/llvm-project/build/Release/bin/cir-opt+0x101682d93)

I reduced the problem to

#true = #cir.bool<true> : !cir.bool

cir.func @test4() {
    %6 = cir.const #true
    cir.if %6 {
    } else {
    }
    cir.return
  }

While the following snippet do pass

#true = #cir.bool<true> : !cir.bool

cir.func @test4() {
    %6 = cir.const #true
    cir.if %6 {
          %5 = cir.const #true

    } else {
    }
    cir.return
  }

I am now building with debug and will try to understand the cause for this issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant