Have the verifier check that all landingpad operands are constants.
authorDuncan Sands <baldrick@free.fr>
Tue, 27 Sep 2011 16:43:19 +0000 (16:43 +0000)
committerDuncan Sands <baldrick@free.fr>
Tue, 27 Sep 2011 16:43:19 +0000 (16:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140606 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Verifier.cpp

index 5936d80983561498aa265c3bd851ddee688fb51e..804d9c5d3b8aaa2027959add2653f5263e5920ec 100644 (file)
@@ -1449,6 +1449,17 @@ void Verifier::visitLandingPadInst(LandingPadInst &LPI) {
             "Personality function doesn't match others in function", &LPI);
   PersonalityFn = LPI.getPersonalityFn();
 
+  // All operands must be constants.
+  Assert1(isa<Constant>(PersonalityFn), "Personality function is not constant!",
+          &LPI);
+  for (unsigned i = 0, e = LPI.getNumClauses(); i < e; ++i) {
+    Value *Clause = LPI.getClause(i);
+    Assert1(isa<Constant>(Clause), "Clause is not constant!", &LPI);
+    if (LPI.isFilter(i))
+      Assert1(isa<ConstantArray>(Clause) || isa<ConstantAggregateZero>(Clause),
+              "Filter is not an array of constants!", &LPI);
+  }
+
   visitInstruction(LPI);
 }