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

Verifier doesn't catch invalid invoke use #1414

Closed
asl opened this issue Dec 11, 2006 · 11 comments
Closed

Verifier doesn't catch invalid invoke use #1414

asl opened this issue Dec 11, 2006 · 11 comments
Assignees
Labels
accepts-invalid bugzilla Issues migrated from bugzilla llvm:core

Comments

@asl
Copy link
Collaborator

asl commented Dec 11, 2006

Bugzilla Link 1042
Resolution FIXED
Resolved on Feb 22, 2010 12:41
Version 1.0
OS Linux
Blocks #1413
Attachments test.bc bytecode
CC @lattner

Extended Description

Running ./llc test.bc results to (bytecode passes verifier):

llc: /home/asl/proj/llvm/src/lib/CodeGen/LiveVariables.cpp:157: void
llvm::LiveVariables::HandleVirtRegUse(llvm::LiveVariables::VarInfo&,
llvm::MachineBasicBlock*, llvm::MachineInstr*): Assertion `VRInfo.DefInst &&
"Register use before def!"' failed.
./llc((anonymous namespace)::PrintStackTrace()+0x1f)[0x859b96f]
/lib/libc.so.6(abort+0xeb)[0xb7d83133]
/lib/libc.so.6(__assert_fail+0xeb)[0xb7d7b4f3]
./llc(llvm::LiveVariables::HandleVirtRegUse(llvm::LiveVariables::VarInfo&,
llvm::MachineBasicBlock*, llvm::MachineInstr*)+0x13c)[0x842bbec]

@asl
Copy link
Collaborator Author

asl commented Dec 11, 2006

assigned to @lattner

@lattner
Copy link
Collaborator

lattner commented Dec 12, 2006

evan, can you investigate?

@llvmbot
Copy link
Collaborator

llvmbot commented Dec 12, 2006

This test is huge and bugpoint is having all kinds of trouble with it. Anton, do
you have any luck reducing it?

It looks like a phi node updating problem though.

@llvmbot
Copy link
Collaborator

llvmbot commented Dec 12, 2006

@llvmbot
Copy link
Collaborator

llvmbot commented Dec 12, 2006

This is bad LLVM code:

cond_true.i: ; preds = %meshBB1602
%ov1051 = xor int %cv2693, 29 ; [#uses=4]
%ov1408 = xor int %ov1051, 0 ; [#uses=1]
%tmp8.i = invoke fastcc uint %_ZN10polynomialIdE11stretch_fftEv(
"struct.polynomial"* %a1.i )
to label %meshBB1569 unwind label %cleanup86.i
; [#uses=2]

invcont7.i: ; preds = %meshBB1569
%tmp.i.i3 = seteq uint %tmp8.i, 0 ; [#uses=1]
%ov1039 = xor int %cv2797, 226 ; [#uses=2]
br bool %tmp.i.i3, label %cond_next.i, label %cond_true.i.i4

%meshBB1569 is just a bunch of phi node but it does not reference nor define %tmp8.i

live variable analysis chokes in invcont7.i because %tmp8.i is used but it is
not defined nor live-in.

Chris believes this is a verifier bug.

@lattner
Copy link
Collaborator

lattner commented Dec 12, 2006

the verifier should reject this:

int %foo() {
%A = invoke int %foo( )
to label %L unwind label %L ; [#uses=1]

L: ; preds = %0, %0
ret int %A
}

%A does not dominate L.

@lattner
Copy link
Collaborator

lattner commented Dec 12, 2006

Here's another case the verifier should reject that crashes livevar:

int %foo() {
br bool false, label %L1, label %L2
L1:
%A = invoke int %foo() to label %L unwind label %L

L2:
br label %L
L:
ret int %A
}

@lattner
Copy link
Collaborator

lattner commented Dec 12, 2006

I've fixed the verifier bug, but the new check exposes bugs in other passes, it will take a while to track
these down.

-Chris

@lattner
Copy link
Collaborator

lattner commented Dec 16, 2006

This is actually a verifier bug not rejecting broken code. Fixed with this patch:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20061211/041486.html

Testcases here: test/Regression/Verifier/invoke-[12].ll

Note that the broken LLVM code was made by some transformation that is buggy. That means that if
you try to compile the source that produced this again, you'll get an assert. Please file another bug so
we can fix that.

Thanks,

-Chris

@asl
Copy link
Collaborator Author

asl commented Dec 18, 2006

invoke-1.ll is not rejected by verifier. Everything is ok for invoke-2.ll

@llvmbot
Copy link
Collaborator

llvmbot commented Dec 18, 2006

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

No branches or pull requests

3 participants