[llvm] [InstCombine] Fix a cycle when folding fneg(select) with scalable vector types (PR #112465)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 00:10:28 PDT 2024


================
@@ -2878,7 +2878,8 @@ Instruction *InstCombinerImpl::visitFNeg(UnaryOperator &I) {
 
     // -(Cond ? X : C) --> Cond ? -X : -C
     // -(Cond ? C : Y) --> Cond ? -C : -Y
-    if (match(X, m_ImmConstant()) || match(Y, m_ImmConstant())) {
+    if ((match(X, m_ImmConstant()) && !isa<ScalableVectorType>(X->getType())) ||
----------------
arsenm wrote:

The IRBuilder should do this like in other cases? 

https://github.com/llvm/llvm-project/pull/112465


More information about the llvm-commits mailing list