From ef3c1884ecd41305714e1ac4b0887d886c7a2b88 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Wed, 24 Apr 2019 20:21:32 +0000 Subject: [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 --- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms') 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(Op) && + if ((isa(Op) && isa(OpLastLane) && cast(Op)->getOpcode() == cast(OpLastLane)->getOpcode()) || + (isa(OpLastLane) && isa(Op)) || isa(Op)) { // An instruction has a higher score than an undef. unsigned Score = (isa(Op)) ? GoodScore : BestScore; -- cgit v1.2.3