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

Regression (r273545): Bad machine code: Using an undefined physical register #28669

Open
pcc opened this issue Jun 24, 2016 · 5 comments
Open
Labels
bugzilla Issues migrated from bugzilla llvm:codegen

Comments

@pcc
Copy link
Contributor

pcc commented Jun 24, 2016

Bugzilla Link 28295
Version trunk
OS Linux
Blocks #31494
CC @hfinkel,@MatzeB,@JonPsson,@qcolombet

Extended Description

e.g.
https://build.chromium.org/p/chromium.fyi/builders/ClangToTAndroidASan/builds/3365

Working on a reproducer.

@pcc
Copy link
Contributor Author

pcc commented Jun 24, 2016

$ cat test.cpp
class A {};
class B {
public:
A m_fn1();
};
class C {
public:
C();
void operator&(A);
};
using InterfaceId = int;
class D;
class F {
class G;
enum ClientCallBehavior {};
bool m_fn2(D *, ClientCallBehavior *);
void m_fn3();
G *m_fn4(InterfaceId, bool);
};
class F::G {
public:
bool m_fn5() { return closed_; }
bool closed_;
};

bool a;
bool F::m_fn2(D *p1, ClientCallBehavior *) {
A b;
InterfaceId c = 0;
G *d = m_fn4(c, a);
if (d->m_fn5())
return true;
if (d)
return false;
B().m_fn1();
C() & b;
if (p1)
m_fn3();
return true;
}

$ clang++ -fstack-protector --target=arm-linux-androideabi -march=armv7-a -mthumb -Os -fsanitize=address -std=gnu++11 -c test.cpp
[...]
*** Bad machine code: MBB exits via unconditional fall-through but its successor differs from its CFG successor! ***

  • function: _ZN1F5m_fn2EP1DPNS_18ClientCallBehaviorE
  • basic block: BB#6 (null) (0x4fb3df0)

*** Bad machine code: MBB exits via unconditional fall-through but its successor differs from its CFG successor! ***

  • function: _ZN1F5m_fn2EP1DPNS_18ClientCallBehaviorE
  • basic block: BB#8 (null) (0x4fb3ea0)

*** Bad machine code: Using an undefined physical register ***

  • function: _ZN1F5m_fn2EP1DPNS_18ClientCallBehaviorE
  • basic block: BB#9 if.end5 (0x4f98b88)
  • instruction: BUNDLE
  • operand 166: %R0_R1<imp-use,kill>

*** Bad machine code: Using an undefined physical register ***

  • function: _ZN1F5m_fn2EP1DPNS_18ClientCallBehaviorE
  • basic block: BB#9 if.end5 (0x4f98b88)
  • instruction: %R0 = tMOVr
  • operand 4: %R0

*** Bad machine code: Using an undefined physical register ***

  • function: _ZN1F5m_fn2EP1DPNS_18ClientCallBehaviorE
  • basic block: BB#9 if.end5 (0x4f98b88)
  • instruction: tBL
  • operand 11: %R0_R1<imp-use,kill>
    fatal error: error in backend: Found 5 machine code errors.

@JonPsson
Copy link
Contributor

I have reopened the Phabricator revision for this patch. Go there for a first analysis of the provided test case.

http://reviews.llvm.org/D20907

@qcolombet
Copy link
Collaborator

I have reopened the Phabricator revision for this patch. Go there for a
first analysis of the provided test case.

http://reviews.llvm.org/D20907

Commented there. For tracking purposes summarizing what I said.
I believe the patch itself is correct but the liveness information we get within IfConversion is incorrect and we need to figure out why.

@JonPsson
Copy link
Contributor

JonPsson commented Aug 3, 2016

I reran this test case after re-commiting the bug fix for IfConversion. The live-in lists are indeed more reasonable (thanks to Matthias' fix on https://reviews.llvm.org/D22027), and the particular error we saw before here is now gone :-)

However, this test case gets stopped by the verifier at a later stage, after "Unpack machine instruction bundles". Not sure what is going on there...

@fhahn
Copy link
Contributor

fhahn commented Nov 26, 2021

mentioned in issue #31494

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla llvm:codegen
Projects
None yet
Development

No branches or pull requests

4 participants