diff options
author | Layton Kifer <laytonkifer@gmail.com> | 2020-12-23 16:13:52 -0800 |
---|---|---|
committer | Jordan Rupprecht <rupprecht@google.com> | 2020-12-23 16:16:26 -0800 |
commit | d29f93bda5114aec596c0cbb1e3ce37b61c6398c (patch) | |
tree | 8ba7146bbf89332fe0b346f03aa6d2b92468283d /clang/lib/CodeGen/CodeGenAction.cpp | |
parent | ca1ab0c66d1c499d4ddcf723dcba692792d531a7 (diff) | |
download | llvm-d29f93bda5114aec596c0cbb1e3ce37b61c6398c.zip llvm-d29f93bda5114aec596c0cbb1e3ce37b61c6398c.tar.gz llvm-d29f93bda5114aec596c0cbb1e3ce37b61c6398c.tar.bz2 |
[DAGCombiner] Don't create sexts of deleted xors when they were in-visit replaced
Fixes a bug introduced by D91589.
When folding `(sext (not i1 x)) -> (add (zext i1 x), -1)`, we try to replace the not first when possible. If we replace the not in-visit, then the now invalidated node will be returned, and subsequently we will return an invalid sext. In cases where the not is replaced in-visit we can simply return SDValue, as the not in the current sext should have already been replaced.
Thanks @jgorbe, for finding the below reproducer.
The following reduced test case crashes clang when built with `clang -O1 -frounding-math`:
```
template <class> class a {
int b() { return c == 0.0 ? 0 : -1; }
int c;
};
template class a<long>;
```
A debug build of clang produces this "assertion failed" error:
```
clang: /home/jgorbe/code/llvm/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:264: void {anonymous}::DAGCombiner::AddToWorklist(llvm::
SDNode*): Assertion `N->getOpcode() != ISD::DELETED_NODE && "Deleted Node added to Worklist"' failed.
```
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D93274
Diffstat (limited to 'clang/lib/CodeGen/CodeGenAction.cpp')
0 files changed, 0 insertions, 0 deletions