[PATCH] D49229: [InstCombine] Fold redundant masking operations of shifted value

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 30 04:10:49 PDT 2018


lebedev.ri added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2058
+      Builder.CreateBinOp(Opcode, And, ConstantInt::get(I.getType(), *ShftAmt));
+  DeadAnd->replaceAllUsesWith(NewShift);
+  return BinaryOperator::CreateOr(And, NewShift);
----------------
But how do you know it's dead? I don't think you checked that it is one-use?
And if it is one-use, then it will be dead after the parent instruction will be replaced, so why do we care?
I guess you want to add a bit more tests.


https://reviews.llvm.org/D49229





More information about the llvm-commits mailing list