[llvm] 7b362dd - [SCCP] Preserve Name when converting SExt->ZExt.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue May 10 09:14:05 PDT 2022


Author: Craig Topper
Date: 2022-05-10T09:13:59-07:00
New Revision: 7b362ddda9ca53906b0be6fe30c64fd1a910d9d4

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

LOG: [SCCP] Preserve Name when converting SExt->ZExt.

This makes the output IR more readable since we're doing a one to
one replacement.

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D125280

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/SCCP.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp
index 26c4ca125965..384e2181f433 100644
--- a/llvm/lib/Transforms/Scalar/SCCP.cpp
+++ b/llvm/lib/Transforms/Scalar/SCCP.cpp
@@ -164,6 +164,7 @@ static bool simplifyInstsInBlock(SCCPSolver &Solver, BasicBlock &BB,
         continue;
       if (IV.getConstantRange().isAllNonNegative()) {
         auto *ZExt = new ZExtInst(ExtOp, Inst.getType(), "", &Inst);
+        ZExt->takeName(&Inst);
         InsertedValues.insert(ZExt);
         Inst.replaceAllUsesWith(ZExt);
         Solver.removeLatticeValueFor(&Inst);


        


More information about the llvm-commits mailing list