[llvm] 3690e1f - [SCEV] Check MatchBinaryOp opcode instead of original opcode

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 02:13:44 PDT 2023


Author: Nikita Popov
Date: 2023-04-27T11:13:35+02:00
New Revision: 3690e1f8a7b49feb3e530c062136f9a801a829b1

URL: https://github.com/llvm/llvm-project/commit/3690e1f8a7b49feb3e530c062136f9a801a829b1
DIFF: https://github.com/llvm/llvm-project/commit/3690e1f8a7b49feb3e530c062136f9a801a829b1.diff

LOG: [SCEV] Check MatchBinaryOp opcode instead of original opcode

These are not necessarily the same (e.g. or can become add) and
this is what we're switching over in the first place.

Added: 
    

Modified: 
    llvm/lib/Analysis/ScalarEvolution.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index d8a269aa9815..861dea21f49b 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -7442,10 +7442,10 @@ ScalarEvolution::getOperandsToCreate(Value *V, SmallVectorImpl<Value *> &Ops) {
         auto NewBO = MatchBinaryOp(BO->LHS, getDataLayout(), AC, DT,
                                    dyn_cast<Instruction>(V));
         if (!NewBO ||
-            (U->getOpcode() == Instruction::Add &&
+            (BO->Opcode == Instruction::Add &&
              (NewBO->Opcode != Instruction::Add &&
               NewBO->Opcode != Instruction::Sub)) ||
-            (U->getOpcode() == Instruction::Mul &&
+            (BO->Opcode == Instruction::Mul &&
              NewBO->Opcode != Instruction::Mul)) {
           Ops.push_back(BO->LHS);
           break;


        


More information about the llvm-commits mailing list