[llvm] e21ccdc - [InstSimplify] Revert unintentional change

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 14 07:27:56 PDT 2023


Author: Nikita Popov
Date: 2023-07-14T16:27:49+02:00
New Revision: e21ccdcd9889a6cfd1254f738ae9ade8bb255647

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

LOG: [InstSimplify] Revert unintentional change

This change was made as part of 91b84811ab11ea169cb8ac3d6ccf8a4b8740ec98,
which was only supposed to add tests.

Added: 
    

Modified: 
    llvm/lib/Analysis/InstructionSimplify.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index c7a5f1548585c2..1c89de3b4cae55 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -4305,8 +4305,10 @@ static Value *simplifyWithOpReplaced(Value *V, Value *Op, Value *RepOp,
       // by assumption and this case never wraps, so nowrap flags can be
       // ignored.
       if ((Opcode == Instruction::Sub || Opcode == Instruction::Xor) &&
-          NewOps[0] == RepOp && NewOps[1] == RepOp)
+          NewOps[0] == NewOps[1]) {
+        assert(NewOps[0] == RepOp && "Precondition for non-poison assumption");
         return Constant::getNullValue(I->getType());
+      }
 
       // If we are substituting an absorber constant into a binop and extra
       // poison can't leak if we remove the select -- because both operands of


        


More information about the llvm-commits mailing list