[llvm] 4d7f3d6 - [llvm] Fix for failing test from cf8ff75bade763b054476321dcb82dcb2e7744c7

Leonard Chan via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 17:22:44 PST 2020


Author: Leonard Chan
Date: 2020-11-30T17:22:28-08:00
New Revision: 4d7f3d68f1735ad343a15604559e7d55ac14bfb5

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

LOG: [llvm] Fix for failing test from cf8ff75bade763b054476321dcb82dcb2e7744c7

Handle null values when handling operand changes for DSOLocalEquivalent.

Added: 
    

Modified: 
    llvm/lib/IR/Constants.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index 7ebe461fd0c2..eba8c8eeaa87 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -1862,6 +1862,11 @@ Value *DSOLocalEquivalent::handleOperandChangeImpl(Value *From, Value *To) {
       return NewEquiv;
   }
 
+  // If the argument is replaced with a null value, just replace this constant
+  // with a null value.
+  if (cast<Constant>(To)->isNullValue())
+    return To;
+
   // The replacement could be a bitcast or an alias to another function. We can
   // replace it with a bitcast to the dso_local_equivalent of that function.
   auto *Func = cast<Function>(To->stripPointerCastsAndAliases());


        


More information about the llvm-commits mailing list