New issue
Advanced search Search tips

Issue 829252 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2018
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug

Blocked on:
issue 828582



Sign in to add a comment

Clang error during instrumented build: "musttail call must be precede a ret with an optional bitcast"

Project Member Reported by h...@chromium.org, Apr 5 2018

Issue description

I ran into this with the pinned clang (328575) while trying to build a cygprofile-instrumented 32-bit chrome:

gn gen out\instrument --args="is_debug=false is_official_build=true generate_order_files=true symbol_level=1 use_goma=true target_cpu=\"x86\""
ninja -j800 -C out\instrument chrome

Attaching the repro.
 
repro.zip
3.4 MB Download

Comment 1 by h...@chromium.org, Apr 5 2018

Also reproduces with tip-of-tree Clang.

Comment 2 by h...@chromium.org, Apr 5 2018

Currently reducing, but it's taking a while.

This is the full error message:

musttail call must be precede a ret with an optional bitcast
  musttail call x86_thiscallcc void @"?ProcessKeyEvent@InputMethodEngine@input_method@@UAEXABVKeyEvent@ui@@V?$OnceCallback@$$A6AX_N@Z@base@@@Z"(i8* %4, <{ %"class.ui::KeyEvent"*, %"class.base::OnceCallback"
}>* inalloca nonnull %0) #14
fatal error: error in backend: Broken function found, compilation aborted!

That ProcessKeyEvent is the one mentioned in  crbug.com/822202 


Comment 3 by h...@chromium.org, Apr 5 2018

This probably doesn't block the Clang roll actually, but it would be nice to get fixed.

Comment 4 by h...@chromium.org, Apr 6 2018

Reid's example from  Issue 822202  can be used to reproduce:

$ cat /tmp/a.cc
struct Incomplete;
struct A {
  A() {}
  virtual ~A() {}
  virtual void asdf() = 0;
  virtual void foo(Incomplete p) = 0;
  int a;
};
struct B : virtual A {
  B();
  ~B() override;
  void foo(Incomplete p) override;
  virtual void bar();
  int b;
};
struct C {
  C() {}
  virtual ~C() {}
  virtual void baz() = 0;
  int c;
};
struct D : B, C {
  D();
  ~D() override;
  void asdf() override {}
  //void foo(Incomplete p) override;
  void bar() override;
  void baz() override;
  int d;
};

D::D() {}
D::~D() {}
//void D::foo(Incomplete p) {}
void D::bar() {}
void D::baz() {}
$ bin/clang -cc1 -triple i386-pc-windows-msvc19.11.0 -emit-obj -finstrument-functions-after-inlining /tmp/a.cc
musttail call must be precede a ret with an optional bitcast
  musttail call x86_thiscallcc void (%struct.B*, ...) bitcast (void ()* @"?foo@B@@UAEXUIncomplete@@@Z" to void (%struct.B*, ...)*)(%struct.B* %6, ...)
fatal error: error in backend: Broken function found, compilation aborted!

Comment 5 by h...@chromium.org, Apr 6 2018

IR repro:

$ cat /tmp/a.ll
declare void @foo()

define void @bar() #0 {
  musttail call void @foo()
  ret void
}

attributes #0 = { "instrument-function-exit-inlined"="__cyg_profile_func_exit" }

$ bin/opt -passes="function(post-inline-ee-instrument)" -S /tmp/a.ll
musttail call must be precede a ret with an optional bitcast
  musttail call void @foo()
LLVM ERROR: Broken module found, compilation aborted!

Comment 6 by h...@chromium.org, Apr 6 2018

Blockedon: 828582
Blocking: -828582
Status: Started (was: Assigned)
r329385 should do it.

Comment 7 by h...@chromium.org, May 7 2018

Status: Fixed (was: Started)

Sign in to add a comment