llvm-project/llvm/lib/CodeGen/SelectionDAG
Layton Kifer d29f93bda5 [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
2020-12-23 16:16:26 -08:00
..
CMakeLists.txt llvmbuildectomy - replace llvm-build by plain cmake 2020-11-13 10:35:24 +01:00
DAGCombiner.cpp [DAGCombiner] Don't create sexts of deleted xors when they were in-visit replaced 2020-12-23 16:16:26 -08:00
FastISel.cpp Revert "[FastISel] Flush local value map on ever instruction" and dependent patches 2020-12-01 14:26:23 -08:00
FunctionLoweringInfo.cpp [NFC] Set return type of getStackPointerRegisterToSaveRestore to Register 2020-10-21 16:19:38 -07:00
InstrEmitter.cpp [CSSPGO] Pseudo probes for function calls. 2020-12-02 13:45:20 -08:00
InstrEmitter.h [DebugInstrRef] Create DBG_INSTR_REFs in SelectionDAG 2020-10-14 14:24:08 +01:00
LegalizeDAG.cpp Add intrinsics for saturating float to int casts 2020-12-18 11:09:41 +01:00
LegalizeFloatTypes.cpp Add intrinsics for saturating float to int casts 2020-12-18 11:09:41 +01:00
LegalizeIntegerTypes.cpp Add intrinsics for saturating float to int casts 2020-12-18 11:09:41 +01:00
LegalizeTypes.cpp [SVE][CodeGen][NFC] Replace TypeSize comparison operators with their scalar equivalents 2020-10-19 08:30:31 +01:00
LegalizeTypes.h Add intrinsics for saturating float to int casts 2020-12-18 11:09:41 +01:00
LegalizeTypesGeneric.cpp [CodeGen] Refactor getMemBasePlusOffset & getObjectPtrOffset to accept a TypeSize 2020-08-11 12:17:10 +01:00
LegalizeVectorOps.cpp Add intrinsics for saturating float to int casts 2020-12-18 11:09:41 +01:00
LegalizeVectorTypes.cpp [LegalizeType] When LegalizeType procedure widens a masked_gather, set MemoryType's EltNum equal to Result's EltNum 2020-12-22 13:27:38 +08:00
ResourcePriorityQueue.cpp ResourcePriorityQueue.h - reduce unnecessary includes to forward declarations. NFC. 2020-05-26 19:22:14 +01:00
SDNodeDbgValue.h
ScheduleDAGFast.cpp [DebugInstrRef] Create DBG_INSTR_REFs in SelectionDAG 2020-10-14 14:24:08 +01:00
ScheduleDAGRRList.cpp Revert "[NFC][ScheduleDAG] Remove unused EntrySU SUnit" 2020-09-21 13:33:05 +02:00
ScheduleDAGSDNodes.cpp [DebugInstrRef] Create DBG_INSTR_REFs in SelectionDAG 2020-10-14 14:24:08 +01:00
ScheduleDAGSDNodes.h DAG: Use Register 2020-04-08 13:44:31 -04:00
ScheduleDAGVLIW.cpp Revert "[NFC][ScheduleDAG] Remove unused EntrySU SUnit" 2020-09-21 13:33:05 +02:00
SelectionDAG.cpp [X86] Add X86ISD::SUBV_BROADCAST_LOAD and begin removing X86ISD::SUBV_BROADCAST (PR38969) 2020-12-17 10:25:25 +00:00
SelectionDAGAddressAnalysis.cpp [SelectionDAG] Avoid aliasing analysis if the object size is unknown. 2020-11-25 06:13:37 +08:00
SelectionDAGBuilder.cpp Add intrinsics for saturating float to int casts 2020-12-18 11:09:41 +01:00
SelectionDAGBuilder.h [VP] Build VP SDNodes 2020-12-09 11:36:51 +01:00
SelectionDAGDumper.cpp Add intrinsics for saturating float to int casts 2020-12-18 11:09:41 +01:00
SelectionDAGISel.cpp [IR, CodeGen] Use llvm::is_contained (NFC) 2020-12-16 21:30:44 -08:00
SelectionDAGPrinter.cpp Utility to dump .dot representation of SelectionDAG without firing viewer 2020-06-04 11:51:48 +05:30
SelectionDAGTargetInfo.cpp
StatepointLowering.cpp [Statepoints] Disable VReg lowering for values used on exception path of invoke. 2020-12-21 20:27:05 +07:00
StatepointLowering.h [Statepoint] Consolidate relocation type tracking [NFC] 2020-07-29 11:45:31 -07:00
TargetLowering.cpp Add intrinsics for saturating float to int casts 2020-12-18 11:09:41 +01:00