[llvm] b87110e - [SimplifyCFG] Avoid use of ConstantExpr::getIntegerCast() (NFC)
    Nikita Popov via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Nov  1 03:55:19 PDT 2023
    
    
  
Author: Nikita Popov
Date: 2023-11-01T11:55:11+01:00
New Revision: b87110e298df6b4c93592f8418582fc4b3133d4a
URL: https://github.com/llvm/llvm-project/commit/b87110e298df6b4c93592f8418582fc4b3133d4a
DIFF: https://github.com/llvm/llvm-project/commit/b87110e298df6b4c93592f8418582fc4b3133d4a.diff
LOG: [SimplifyCFG] Avoid use of ConstantExpr::getIntegerCast() (NFC)
We're working on a ConstantInt here, so constant folding will
always succeed. Just avoid using the ConstantExpr API.
Added: 
    
Modified: 
    llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Removed: 
    
################################################################################
diff  --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 68b5b1a78a3460e..5ef3a5292af545c 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -502,7 +502,7 @@ static ConstantInt *GetConstantInt(Value *V, const DataLayout &DL) {
           return CI;
         else
           return cast<ConstantInt>(
-              ConstantExpr::getIntegerCast(CI, PtrTy, /*isSigned=*/false));
+              ConstantFoldIntegerCast(CI, PtrTy, /*isSigned=*/false, DL));
       }
   return nullptr;
 }
        
    
    
More information about the llvm-commits
mailing list