diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2019-04-24 20:21:32 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-04-24 20:21:32 +0000 |
commit | ef3c1884ecd41305714e1ac4b0887d886c7a2b88 (patch) | |
tree | 9e9a96c830e7ef33d49b0799943b80b9a70f9299 /llvm/lib/Transforms | |
parent | c06a470fc84352642e670a0159bb4846f5aa2a3c (diff) | |
download | bcm5719-llvm-ef3c1884ecd41305714e1ac4b0887d886c7a2b88.tar.gz bcm5719-llvm-ef3c1884ecd41305714e1ac4b0887d886c7a2b88.zip |
[SLP] Fix crash after r358519, by V. Porpodas.
Summary: The code did not check if operand was undef before casting it to Instruction.
Reviewers: RKSimon, ABataev, dtemirbulatov
Reviewed By: ABataev
Subscribers: uabelho
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61024
llvm-svn: 359136
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 621ea1d2e7f..e45787f1aa7 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -785,9 +785,10 @@ public: break; case ReorderingMode::Opcode: // We accept both Instructions and Undefs, but with different scores. - if ((isa<Instruction>(Op) && + if ((isa<Instruction>(Op) && isa<Instruction>(OpLastLane) && cast<Instruction>(Op)->getOpcode() == cast<Instruction>(OpLastLane)->getOpcode()) || + (isa<UndefValue>(OpLastLane) && isa<Instruction>(Op)) || isa<UndefValue>(Op)) { // An instruction has a higher score than an undef. unsigned Score = (isa<UndefValue>(Op)) ? GoodScore : BestScore; |