[llvm-branch-commits] [llvm] fe20657 - [ConstantFold] Remove handling for comparison of bitcasted global (NFCI)

Nikita Popov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Nov 3 13:41:09 PDT 2023


Author: Nikita Popov
Date: 2023-11-03T12:20:07+01:00
New Revision: fe206578f2e9b864ec6a703974a0e2a9001bb11b

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

LOG: [ConstantFold] Remove handling for comparison of bitcasted global (NFCI)

The bitcast will be folded away in this case, no need to handle it
explicitly.

Added: 
    

Modified: 
    llvm/lib/IR/ConstantFold.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 1d7785760214f77..a10796e6da99dca 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -1244,12 +1244,6 @@ static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2,
 
     switch (CE1->getOpcode()) {
     case Instruction::BitCast:
-      // If this is a global value cast, check to see if the RHS is also a
-      // GlobalValue.
-      if (const GlobalValue *GV = dyn_cast<GlobalValue>(CE1Op0))
-        if (const GlobalValue *GV2 = dyn_cast<GlobalValue>(V2))
-          return areGlobalsPotentiallyEqual(GV, GV2);
-
       // We can't evaluate floating point casts or truncations.
       if (CE1Op0->getType()->isFPOrFPVectorTy())
         break;


        


More information about the llvm-branch-commits mailing list