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

Assertion failed: Referenced value not in value map! #316

Open
VoxSciurorum opened this issue Feb 18, 2025 · 2 comments
Open

Assertion failed: Referenced value not in value map! #316

VoxSciurorum opened this issue Feb 18, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@VoxSciurorum
Copy link
Contributor

This error is on dev/19.x. Compile the input file (text bitcode) -O1 -fopencilk.
compress.txt
The compiler crashes with

Assertion failed: ((Flags & RF_IgnoreMissingLocals) && "Referenced value not in value map!"), function remapInstruction, file /data/Cilk/opencilk-project/llvm/lib/Transforms/Utils/ValueMapper.cpp, line 979.

The bad instruction is

  %call55.otd1 = invoke noundef i32 @_Z21BZ2_compressBlockCilkP6EStateR16opencilk_reducerI6writerEPKhS6_(ptr noundef %retval.0.i.otd1, ptr noundef nonnull align 8 dereferenceable(56) %output.otd1, ptr noundef %base.066.otd1, ptr noundef %last.2.otd1)
          to label %invoke.cont54.otd1 unwind label %terminate.lpad.loopexit, !dbg !2514

and the bad value (not in map) is label %terminate.lpad.loopexit.

@VoxSciurorum VoxSciurorum added the bug Something isn't working label Feb 18, 2025
@VoxSciurorum
Copy link
Contributor Author

The reduce utility reduced the input file to the following:

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-unknown-freebsd14.2"

define i32 @BZ2_compressDescriptorCilk() personality ptr null {
entry:
  %syncreg = call token @llvm.syncregion.start()
  br label %while.cond

while.cond:                                       ; preds = %invoke.cont54, %invoke.cont19, %entry
  %call20 = invoke ptr @_ZL22BZ2_bzCompressInitCilkiii(i32 0, i32 0, i32 0)
          to label %invoke.cont19 unwind label %terminate.lpad

invoke.cont19:                                    ; preds = %while.cond
  detach within %syncreg, label %det.achd, label %while.cond

det.achd:                                         ; preds = %invoke.cont19
  %call55 = invoke i32 @_Z21BZ2_compressBlockCilkP6EStateR16opencilk_reducerI6writerEPKhS6_(ptr null, ptr null, ptr null, ptr null)
          to label %invoke.cont54 unwind label %terminate.lpad

invoke.cont54:                                    ; preds = %det.achd
  reattach within %syncreg, label %while.cond

terminate.lpad:                                   ; preds = %det.achd, %while.cond
  %0 = landingpad { ptr, i32 }
          catch ptr null
  store volatile i32 0, ptr null, align 4
  unreachable
}

declare ptr @_ZL22BZ2_bzCompressInitCilkiii()

; Function Attrs: nounwind willreturn memory(argmem: readwrite)
declare token @llvm.syncregion.start() #0

declare i32 @_Z21BZ2_compressBlockCilkP6EStateR16opencilk_reducerI6writerEPKhS6_()

; uselistorder directives
uselistorder ptr null, { 1, 2, 3, 4, 5, 6, 7, 8, 0 }

attributes #0 = { nounwind willreturn memory(argmem: readwrite) }

@VoxSciurorum
Copy link
Contributor Author

Here is a reduced C++ test case. The noexcept keyword is key.

extern bool more();
extern int f();

void g() noexcept
{
  while (more())
    cilk_spawn f();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant