diff options
author | Alex Bradbury <asb@lowrisc.org> | 2019-01-22 12:11:53 +0000 |
---|---|---|
committer | Alex Bradbury <asb@lowrisc.org> | 2019-01-22 12:11:53 +0000 |
commit | cd26560e46c2a2a50dbc79775b9a8bba03990945 (patch) | |
tree | 6e0abce281e4ba6bc1fa626ea49d8f263b19ffc7 /llvm/lib/Target/RISCV/RISCVISelLowering.cpp | |
parent | feb475f4cf283e78e7e3979a20bb5337bce6d889 (diff) | |
download | bcm5719-llvm-cd26560e46c2a2a50dbc79775b9a8bba03990945.tar.gz bcm5719-llvm-cd26560e46c2a2a50dbc79775b9a8bba03990945.zip |
[RISCV] Quick fix for PR40333
Avoid the infinite loop caused by the target DAG combine converting ANYEXT to
SIGNEXT and the target-independent DAG combine logic converting back to
ANYEXT. Do this by not adding the new node to the worklist.
Committing directly as this definitely doesn't make the problem any worse, and
I intend to follow-up with a patch that avoids this custom combiner logic
altogether and just lowers the i32 operations to a target-specific
SelectionDAG node. This should be easier to reason about and improve codegen
quality in some cases (though may miss out on some later DAG combines).
llvm-svn: 351806
Diffstat (limited to 'llvm/lib/Target/RISCV/RISCVISelLowering.cpp')
-rw-r--r-- | llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index 8a32d957ec5..95943f3dbaf 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -575,7 +575,11 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N, !(Subtarget.hasStdExtM() && isVariableSDivUDivURem(Src))) break; SDLoc DL(N); - return DCI.CombineTo(N, DAG.getNode(ISD::SIGN_EXTEND, DL, MVT::i64, Src)); + // Don't add the new node to the DAGCombiner worklist, in order to avoid + // an infinite cycle due to SimplifyDemandedBits converting the + // SIGN_EXTEND back to ANY_EXTEND. + return DCI.CombineTo(N, DAG.getNode(ISD::SIGN_EXTEND, DL, MVT::i64, Src), + false); } case RISCVISD::SplitF64: { // If the input to SplitF64 is just BuildPairF64 then the operation is |