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

ScheduleDAG.cpp patch: error message more meaningful. #1556

Closed
llvmbot opened this issue Feb 7, 2007 · 6 comments
Closed

ScheduleDAG.cpp patch: error message more meaningful. #1556

llvmbot opened this issue Feb 7, 2007 · 6 comments
Labels
bugzilla Issues migrated from bugzilla llvm:codegen

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 7, 2007

Bugzilla Link 1184
Resolution FIXED
Resolved on Feb 22, 2010 12:41
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor

Extended Description

Small patch to make tracking down (self-inflicted) bugs easier when the
scheduler barfs. The assert() wasn't really helpful at all. At least this patch
tells you which instruction and operand to go look at.

(Note: In the end, yes, it was my fault, but this patch actually helped.)

Index: lib/CodeGen/SelectionDAG/ScheduleDAG.cpp

--- lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (revision 522)
+++ lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (working copy)
@@ -301,9 +301,20 @@
if (II) {
const TargetRegisterClass *RC =
getInstrOperandRegClass(MRI, TII, II, IIOpNum);

  •  const TargetRegisterClass *VRC = RegMap->getRegClass(VReg);
     assert(RC && "Don't have operand info for this instruction!");
    
  •  assert(RegMap->getRegClass(VReg) == RC &&
    
  •         "Register class of operand and regclass of use don't agree!");
    
  •  if (VRC != RC) {
    
  •   cerr << "Register class of operand and regclass of use don't agree!\n";
    
  •   cerr << "Operand = " << IIOpNum << "\n";
    
  •   cerr << "Op->Val = "; Op.Val->dump(0); cerr << "\n";
    
  •   cerr << "MI = "; MI->print(cerr);
    
  •   cerr << "VReg = " << VReg << "\n";
    
  •   cerr << "VReg RegClass     size = " << VRC->getSize()
    
  •        << ", align = " << VRC->getAlignment() << "\n";
    
  •   cerr << "Expected RegClass size = " << RC->getSize()
    
  •        << ", align = " << RC->getAlignment() << "\n";
    
  •   abort();
    
  •  }
    
    }
    } else if (ConstantSDNode *C =
    dyn_cast(Op)) {
@llvmbot
Copy link
Collaborator Author

llvmbot commented Feb 7, 2007

Scott,

You have a "dump" in there so that entire block needs to be debug guarded.
Please wrap it in

#ifndef NDEBUG
...
#endif

including the VRC definition .. its only needed in debug builds.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Feb 7, 2007

Hmm .. actually, you're replacing the assert .. its fine :)

@llvmbot
Copy link
Collaborator Author

llvmbot commented Feb 7, 2007

One would think the author of the build system would have this stuff straight.
Unfortunately, I need to recant. NDEBUG is set when assertions are turned off so
the code does need to be wrapped in:

#ifndef NDEBUG
...
#endif

Sorry for the confusion.

Better still, figure out how to handle the VRC != RC case :)

@llvmbot
Copy link
Collaborator Author

llvmbot commented Feb 7, 2007

@llvmbot
Copy link
Collaborator Author

llvmbot commented Feb 13, 2007

Updated (with NDEBUG) patch
Addresses Reid's comments regarding non-debug builds (although, wouldn't you
want to know if this bug showed up). The compromise is to print info only if
NDEBUG isn't set.

@lattner
Copy link
Collaborator

lattner commented Feb 15, 2007

I applied your patch. Please make sure not to use tabs though :)
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070212/044578.html

-Chris

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
kitano-metro pushed a commit to RIKEN-RCCS/llvm-project that referenced this issue Feb 14, 2023
kitano-metro pushed a commit to RIKEN-RCCS/llvm-project that referenced this issue Feb 14, 2023
kitano-metro pushed a commit to RIKEN-RCCS/llvm-project that referenced this issue Feb 14, 2023
This issue was closed.
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

2 participants