[llvm-commits] [llvm] r85722 - in /llvm/trunk: include/llvm/BasicBlock.h include/llvm/Constant.h lib/VMCore/Constants.cpp lib/VMCore/Globals.cpp lib/VMCore/Verifier.cpp
Chris Lattner
sabre at nondot.org
Sun Nov 1 10:11:50 PST 2009
Author: lattner
Date: Sun Nov 1 12:11:50 2009
New Revision: 85722
URL: http://llvm.org/viewvc/llvm-project?rev=85722&view=rev
Log:
the verifier shouldn't modify the IR.
Modified:
llvm/trunk/include/llvm/BasicBlock.h
llvm/trunk/include/llvm/Constant.h
llvm/trunk/lib/VMCore/Constants.cpp
llvm/trunk/lib/VMCore/Globals.cpp
llvm/trunk/lib/VMCore/Verifier.cpp
Modified: llvm/trunk/include/llvm/BasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=85722&r1=85721&r2=85722&view=diff
==============================================================================
--- llvm/trunk/include/llvm/BasicBlock.h (original)
+++ llvm/trunk/include/llvm/BasicBlock.h Sun Nov 1 12:11:50 2009
@@ -241,9 +241,6 @@
/// other than direct branches, switches, etc. to it.
bool hasAddressTaken() const { return SubclassData != 0; }
- /// removeDeadBlockAddress - If there is a blockaddress node for this basic
- /// block, try to remove it and any dead constant users of it.
- void removeDeadBlockAddress();
private:
/// AdjustBlockAddressRefCount - BasicBlock stores the number of BlockAddress
/// objects using it. This is almost always 0, sometimes one, possibly but
Modified: llvm/trunk/include/llvm/Constant.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constant.h?rev=85722&r1=85721&r2=85722&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Constant.h (original)
+++ llvm/trunk/include/llvm/Constant.h Sun Nov 1 12:11:50 2009
@@ -65,6 +65,10 @@
/// true for things like constant expressions that could divide by zero.
bool canTrap() const;
+ /// isConstantUsed - Return true if the constant has users other than constant
+ /// exprs and other dangling things.
+ bool isConstantUsed() const;
+
enum PossibleRelocationsTy {
NoRelocation = 0,
LocalRelocation = 1,
Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=85722&r1=85721&r2=85722&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Sun Nov 1 12:11:50 2009
@@ -160,6 +160,21 @@
}
}
+/// isConstantUsed - Return true if the constant has users other than constant
+/// exprs and other dangling things.
+bool Constant::isConstantUsed() const {
+ for (use_const_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) {
+ const Constant *UC = dyn_cast<Constant>(*UI);
+ if (UC == 0 || isa<GlobalValue>(UC))
+ return true;
+
+ if (UC->isConstantUsed())
+ return true;
+ }
+ return false;
+}
+
+
/// getRelocationInfo - This method classifies the entry according to
/// whether or not it may generate a relocation entry. This must be
Modified: llvm/trunk/lib/VMCore/Globals.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Globals.cpp?rev=85722&r1=85721&r2=85722&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Globals.cpp (original)
+++ llvm/trunk/lib/VMCore/Globals.cpp Sun Nov 1 12:11:50 2009
@@ -75,13 +75,6 @@
}
}
-/// removeDeadBlockAddress - If there is a blockaddress node for this basic
-/// block, try to remove it and any dead constant users of it.
-void BasicBlock::removeDeadBlockAddress() {
- if (!hasAddressTaken()) return;
- removeDeadUsersOfConstant(BlockAddress::get(this));
-}
-
/// Override destroyConstant to make sure it doesn't get called on
/// GlobalValue's because they shouldn't be treated like other constants.
Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=85722&r1=85721&r2=85722&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Sun Nov 1 12:11:50 2009
@@ -661,8 +661,7 @@
// The address of the entry block cannot be taken, unless it is dead.
if (Entry->hasAddressTaken()) {
- Entry->removeDeadBlockAddress();
- Assert1(!Entry->hasAddressTaken(),
+ Assert1(!BlockAddress::get(Entry)->isConstantUsed(),
"blockaddress may not be used with the entry block!", Entry);
}
}
More information about the llvm-commits
mailing list