[llvm-branch-commits] [llvm] 19bdc8e - [llvm] Fix for failing test from fdbd84c6c819d4462546961f6086c1524d5d5ae8

Leonard Chan via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Dec 1 15:52:18 PST 2020


Author: Leonard Chan
Date: 2020-12-01T15:47:55-08:00
New Revision: 19bdc8e5a307f6eb209d4f91620d70bd2f80219e

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

LOG: [llvm] Fix for failing test from fdbd84c6c819d4462546961f6086c1524d5d5ae8

When handling a DSOLocalEquivalent operand change:

- Remove assertion checking that the `To` type and current type are the
  same type. This is not always a requirement.
- Add a missing bitcast from an old DSOLocalEquivalent to the type of
  the new one.

Added: 
    

Modified: 
    llvm/lib/IR/Constants.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index eba8c8eeaa87..64b58559e787 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -1851,7 +1851,6 @@ void DSOLocalEquivalent::destroyConstantImpl() {
 
 Value *DSOLocalEquivalent::handleOperandChangeImpl(Value *From, Value *To) {
   assert(From == getGlobalValue() && "Changing value does not match operand.");
-  assert(To->getType() == getType() && "Mismatched types");
   assert(isa<Constant>(To) && "Can only replace the operands with a constant");
 
   // The replacement is with another global value.
@@ -1859,7 +1858,7 @@ Value *DSOLocalEquivalent::handleOperandChangeImpl(Value *From, Value *To) {
     DSOLocalEquivalent *&NewEquiv =
         getContext().pImpl->DSOLocalEquivalents[ToObj];
     if (NewEquiv)
-      return NewEquiv;
+      return llvm::ConstantExpr::getBitCast(NewEquiv, getType());
   }
 
   // If the argument is replaced with a null value, just replace this constant


        


More information about the llvm-branch-commits mailing list