[llvm] 856c47b - ConstraintElim: assert on invalid union field (NFC) (#115898)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 04:05:58 PST 2024


Author: Ramkumar Ramachandra
Date: 2024-11-13T12:05:53Z
New Revision: 856c47b884ada7dadb1081244821e0acc199cc72

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

LOG: ConstraintElim: assert on invalid union field (NFC) (#115898)

getContextInst currently returns an invalid union field, when it is
called with a ConditionFact, although existing callers don't do this. In
order to error out early and serve as documentation for future callers,
add an assert forbidding the behavior.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/ConstraintElimination.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
index 7c06e0c757e1cc..d2e532d29d07b5 100644
--- a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
@@ -164,6 +164,7 @@ struct FactOrCheck {
   }
 
   Instruction *getContextInst() const {
+    assert(!isConditionFact());
     if (Ty == EntryTy::UseCheck)
       return getContextInstForUse(*U);
     return Inst;


        


More information about the llvm-commits mailing list