[llvm] 2641c1f - [RISCV] Don't custom type legalize fixed vector to scalar integer bitcasts if the fixed vector type isn't legal.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 6 15:00:40 PDT 2021


Author: Craig Topper
Date: 2021-04-06T15:00:33-07:00
New Revision: 2641c1f15ea53125eb4119af036c60553b30f7bf

URL: https://github.com/llvm/llvm-project/commit/2641c1f15ea53125eb4119af036c60553b30f7bf
DIFF: https://github.com/llvm/llvm-project/commit/2641c1f15ea53125eb4119af036c60553b30f7bf.diff

LOG: [RISCV] Don't custom type legalize fixed vector to scalar integer bitcasts if the fixed vector type isn't legal.

We encountered a hang in our internal code base. I'm having trouble
creating a test case because the test that hit it was testing some
code that is not upstream.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 770ff9989711..8bb8badf15b6 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -4129,7 +4129,8 @@ void RISCVTargetLowering::ReplaceNodeResults(SDNode *N,
       SDValue FPConv =
           DAG.getNode(RISCVISD::FMV_X_ANYEXTW_RV64, DL, MVT::i64, Op0);
       Results.push_back(DAG.getNode(ISD::TRUNCATE, DL, MVT::i32, FPConv));
-    } else if (!VT.isVector() && Op0VT.isFixedLengthVector()) {
+    } else if (!VT.isVector() && Op0VT.isFixedLengthVector() &&
+               isTypeLegal(Op0VT)) {
       // Custom-legalize bitcasts from fixed-length vector types to illegal
       // scalar types in order to improve codegen. Bitcast the vector to a
       // one-element vector type whose element type is the same as the result


        


More information about the llvm-commits mailing list