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

[TapirTaskInfo] Allow for shared EH spindles between a task and its p… #317

Open
wants to merge 1 commit into
base: dev/19.x
Choose a base branch
from

Conversation

neboat
Copy link
Collaborator

@neboat neboat commented Feb 24, 2025

…arent, which can arise from Clang emitting a terminate landingpad for a Cilk function.

Fixes issue #316

…arent, which can arise from Clang emitting a terminate landingpad for a Cilk function.
@VoxSciurorum
Copy link
Contributor

In the test case I was working on I only saw a crash if the task-simplify pass removed the taskframe token. I suggest adding a second run line:

; RUN: opt < %s -passes="function(task-simplify),tapir2target" -tapir-target=opencilk -use-opencilk-runtime-bc=false -debug-abi-calls -S | FileCheck %s

@VoxSciurorum
Copy link
Contributor

The change fixes a minimal test case. On the original test case in issue 316 I have a different crash:

Assertion failed: (Outputs.empty() && "Task should have no outputs."), function findAllTaskInputs, file LoweringUtils.cpp, line 195.

To reproduce run opt -passes='tapir-lowering<O1>'.

@VoxSciurorum
Copy link
Contributor

To see the new crash process this IR with opt -passes='function(loop(loop-deletion)),tapir2target.

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()
  invoke void @_ZN16opencilk_reducerI6writerEC2IJP7__sFILEEEEDpT_(ptr null, ptr null)
          to label %while.cond unwind label %terminate.lpad

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, %entry
  %0 = landingpad { ptr, i32 }
          catch ptr null
  %1 = extractvalue { ptr, i32 } %0, 0
  store volatile i32 0, ptr %1, align 4
  unreachable
}

declare void @_ZN16opencilk_reducerI6writerEC2IJP7__sFILEEEEDpT_()

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, 9, 0 }

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

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

Successfully merging this pull request may close these issues.

2 participants