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

trunk 217475 and -g -O2 causing crash #21267

Closed
llvmbot opened this issue Sep 10, 2014 · 9 comments
Closed

trunk 217475 and -g -O2 causing crash #21267

llvmbot opened this issue Sep 10, 2014 · 9 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Sep 10, 2014

Bugzilla Link 20893
Resolution FIXED
Resolved on Nov 11, 2014 20:03
Version trunk
OS Linux
Attachments gzipped C++ source code
Reporter LLVM Bugzilla Contributor
CC @adrian-prantl,@echristo,@emaste,@fredriss,@hfinkel

Extended Description

The attached preprocessed C++ source code, when compiled by today's trunk with
-g -O2, causes a crash.

clang: error: unable to execute command: Killed
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 3.6.0 (trunk 217475)
Target: x86_64-unknown-linux-gnu
Thread model: posix

@llvmbot
Copy link
Collaborator Author

llvmbot commented Sep 10, 2014

assigned to @adrian-prantl

@llvmbot
Copy link
Collaborator Author

llvmbot commented Sep 10, 2014

Stack backtrace

0 clang 0x00000000022f0005 llvm::sys::PrintStackTrace(_IO_FILE*) + 37
1 clang 0x00000000022f080b
2 libpthread.so.0 0x00000036b200f720
3 clang 0x0000000001c6dc62 llvm::SelectionDAG::TransferDbgValues(llvm::SDValue, llvm::SDValue) + 354
4 clang 0x0000000001bd56d8 llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::AliasAnalysis&, llvm::CodeGenOpt::Level) + 2072
5 clang 0x0000000001cafef9 llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 137
6 clang 0x0000000001cafd45 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 2613
7 clang 0x0000000001caeb35 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 933
8 clang 0x0000000001b15bf6

@echristo
Copy link
Contributor

Adrian? This looks like the stuff you've been touching.

@adrian-prantl
Copy link
Collaborator

Compiling this file uses over 24GiB of memory, all metadata. I'll have a look.

@echristo
Copy link
Contributor

Impressive. Most impressive.

@adrian-prantl
Copy link
Collaborator

What happens here is that SelectionDAG is combining two SDNodes and then merging their DbgValues via DAG.TransferDbgValues(), but SelectionDAG::AddDbgValue() doesn't check whether a DbgValue is already in that SDNode's list of DbgValues and happily adds all of them. The testcase with it's plethora of debug variables from layer over layers of inlined boost::* methods drives this into a pathologic situation where — when dagcombining a chain of instructions — our SDNode's DbgValMap is growing exponentially.

The attached patch changes the DbgValMap to have set semantics, which fixes the problem and reduced the memory usage to only ~500MB.

I'm still trying to come up with a usable testcase for this.

@adrian-prantl
Copy link
Collaborator

@adrian-prantl
Copy link
Collaborator

Bugpoint and delta-reduced testcase
Attached a bugpoint and delta-reduced testcase that has SelectionDAG insert two distinct but equivalent SDDebugValues to the same SDNode.
Unfortunately the testcase is still counting 2375 lines.

@fredriss
Copy link
Collaborator

Fixed by r221709

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
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
Projects
None yet
Development

No branches or pull requests

4 participants