[llvm] efece08 - [InstCombine] Remove manual debug loc transfer

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 14 02:07:27 PST 2022


Author: Nikita Popov
Date: 2022-02-14T11:07:05+01:00
New Revision: efece08ae27d8ace684c5119d6696b1a18b2150f

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

LOG: [InstCombine] Remove manual debug loc transfer

While this might be marginally more precise, we generally don't
bother with this in InstCombine, and let the IRBuilder assign the
debug location. I don't see why this one fold, out of the thousands
done in InstCombine, should be treated specially.

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index 6bbb0251f2bc0..d5a5f6586aac5 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -3677,9 +3677,8 @@ Instruction *InstCombinerImpl::visitXor(BinaryOperator &I) {
       APInt FoldConst = C1->getValue().lshr(C2->getValue());
       FoldConst ^= C3->getValue();
       // Prepare the two operands.
-      auto *Opnd0 = cast<Instruction>(Builder.CreateLShr(X, C2));
-      Opnd0->takeName(cast<Instruction>(Op0));
-      Opnd0->setDebugLoc(I.getDebugLoc());
+      auto *Opnd0 = Builder.CreateLShr(X, C2);
+      Opnd0->takeName(Op0);
       return BinaryOperator::CreateXor(Opnd0, ConstantInt::get(Ty, FoldConst));
     }
   }


        


More information about the llvm-commits mailing list