Skip to content

Commit c5eb591

Browse files
authored
Revert "[SelectionDAG] Add preliminary plumbing for samesign flag" (#114647)
Crashes on ARM builds https://lab.llvm.org/buildbot/#/builders/85/builds/2548 ``` DAGCombiner.cpp:16157: SDValue (anonymous namespace)::DAGCombiner::visitFREEZE(SDNode *): Assertion `DAG.isGuaranteedNotToBeUndefOrPoison(R, false) && "Can't create node that may be undef/poison!"' failed. ``` Issue #114648 This reverts commit 19c8475.
1 parent 92daad2 commit c5eb591

File tree

5 files changed

+3
-17
lines changed

5 files changed

+3
-17
lines changed

llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ class MachineIRBuilder {
12671267
/// \return a MachineInstrBuilder for the newly created instruction.
12681268
MachineInstrBuilder buildICmp(CmpInst::Predicate Pred, const DstOp &Res,
12691269
const SrcOp &Op0, const SrcOp &Op1,
1270-
std::optional<unsigned> Flags = std::nullopt);
1270+
std::optional<unsigned> Flgs = std::nullopt);
12711271

12721272
/// Build and insert a \p Res = G_FCMP \p Pred\p Op0, \p Op1
12731273
///

llvm/include/llvm/CodeGen/SelectionDAGNodes.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -411,14 +411,12 @@ struct SDNodeFlags {
411411
NoFPExcept = 1 << 12,
412412
// Instructions with attached 'unpredictable' metadata on IR level.
413413
Unpredictable = 1 << 13,
414-
// Compare instructions which may carry the samesign flag.
415-
SameSign = 1 << 14,
416414

417415
// NOTE: Please update LargestValue in LLVM_DECLARE_ENUM_AS_BITMASK below
418416
// the class definition when adding new flags.
419417

420418
PoisonGeneratingFlags = NoUnsignedWrap | NoSignedWrap | Exact | Disjoint |
421-
NonNeg | NoNaNs | NoInfs | SameSign,
419+
NonNeg | NoNaNs | NoInfs,
422420
};
423421

424422
/// Default constructor turns off all optimization flags.
@@ -440,7 +438,6 @@ struct SDNodeFlags {
440438
void setNoSignedWrap(bool b) { setFlag<NoSignedWrap>(b); }
441439
void setExact(bool b) { setFlag<Exact>(b); }
442440
void setDisjoint(bool b) { setFlag<Disjoint>(b); }
443-
void setSameSign(bool b) { setFlag<SameSign>(b); }
444441
void setNonNeg(bool b) { setFlag<NonNeg>(b); }
445442
void setNoNaNs(bool b) { setFlag<NoNaNs>(b); }
446443
void setNoInfs(bool b) { setFlag<NoInfs>(b); }
@@ -457,7 +454,6 @@ struct SDNodeFlags {
457454
bool hasNoSignedWrap() const { return Flags & NoSignedWrap; }
458455
bool hasExact() const { return Flags & Exact; }
459456
bool hasDisjoint() const { return Flags & Disjoint; }
460-
bool hasSameSign() const { return Flags & SameSign; }
461457
bool hasNonNeg() const { return Flags & NonNeg; }
462458
bool hasNoNaNs() const { return Flags & NoNaNs; }
463459
bool hasNoInfs() const { return Flags & NoInfs; }
@@ -477,7 +473,7 @@ struct SDNodeFlags {
477473
};
478474

479475
LLVM_DECLARE_ENUM_AS_BITMASK(decltype(SDNodeFlags::None),
480-
SDNodeFlags::SameSign);
476+
SDNodeFlags::Unpredictable);
481477

482478
inline SDNodeFlags operator|(SDNodeFlags LHS, SDNodeFlags RHS) {
483479
LHS |= RHS;

llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,9 +1105,6 @@ EmitMachineNode(SDNode *Node, bool IsClone, bool IsCloned,
11051105

11061106
if (Flags.hasDisjoint())
11071107
MI->setFlag(MachineInstr::MIFlag::Disjoint);
1108-
1109-
if (Flags.hasSameSign())
1110-
MI->setFlag(MachineInstr::MIFlag::SameSign);
11111108
}
11121109

11131110
// Emit all of the actual operands of this instruction, adding them to the

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3652,10 +3652,6 @@ void SelectionDAGBuilder::visitICmp(const ICmpInst &I) {
36523652
Op2 = DAG.getPtrExtOrTrunc(Op2, getCurSDLoc(), MemVT);
36533653
}
36543654

3655-
SDNodeFlags Flags;
3656-
Flags.setSameSign(I.hasSameSign());
3657-
SelectionDAG::FlagInserter FlagsInserter(DAG, Flags);
3658-
36593655
EVT DestVT = DAG.getTargetLoweringInfo().getValueType(DAG.getDataLayout(),
36603656
I.getType());
36613657
setValue(&I, DAG.getSetCC(getCurSDLoc(), DestVT, Op1, Op2, Opcode));

llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,9 +653,6 @@ void SDNode::print_details(raw_ostream &OS, const SelectionDAG *G) const {
653653
if (getFlags().hasDisjoint())
654654
OS << " disjoint";
655655

656-
if (getFlags().hasSameSign())
657-
OS << " samesign";
658-
659656
if (getFlags().hasNonNeg())
660657
OS << " nneg";
661658

0 commit comments

Comments
 (0)