[llvm] 0797c18 - [SCCP] Explicitly mark gep as overdefined if ct eval fails

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 3 05:39:38 PDT 2024


Author: Nikita Popov
Date: 2024-09-03T14:39:31+02:00
New Revision: 0797c184c636889f2897746dc71390ae28005c7c

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

LOG: [SCCP] Explicitly mark gep as overdefined if ct eval fails

Don't just leave the result as unknown. I think this currently
works out thanks to undef resolution, but the correct thing to
do is set it to overdefined explicitly.

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/SCCPSolver.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/SCCPSolver.cpp b/llvm/lib/Transforms/Utils/SCCPSolver.cpp
index 56e1f90f46cfd1..1dc82c6e9aa716 100644
--- a/llvm/lib/Transforms/Utils/SCCPSolver.cpp
+++ b/llvm/lib/Transforms/Utils/SCCPSolver.cpp
@@ -1655,6 +1655,8 @@ void SCCPInstVisitor::visitGetElementPtrInst(GetElementPtrInst &I) {
 
   if (Constant *C = ConstantFoldInstOperands(&I, Operands, DL))
     markConstant(&I, C);
+  else
+    markOverdefined(&I);
 }
 
 void SCCPInstVisitor::visitAllocaInst(AllocaInst &I) {


        


More information about the llvm-commits mailing list