diff options
author | Owen Anderson <resistor@mac.com> | 2009-06-19 23:16:19 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-06-19 23:16:19 +0000 |
commit | 430444b10237abd37eb8157c3f84509a7d9636f8 (patch) | |
tree | bb95b125f17911c2cf3abaf7c98b0d1ccb1aa41f /lib/VMCore/ConstantFold.h | |
parent | 4d1c1efd800727165c12c2d186a5cb0b4f5834ab (diff) | |
download | llvm-430444b10237abd37eb8157c3f84509a7d9636f8.tar.gz llvm-430444b10237abd37eb8157c3f84509a7d9636f8.tar.bz2 llvm-430444b10237abd37eb8157c3f84509a7d9636f8.tar.xz |
Fix a serious bug that would cause deadlock during abstract type refinement. The constant creation
gets involved, and we end up trying to recursively acquire a writer lock. The fix for this is slightly horrible,
and involves passing a boolean "locked" parameter around in Constants.cpp, but it's better than having locked and
unlocked versions of most of the code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73790 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.h')
-rw-r--r-- | lib/VMCore/ConstantFold.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/VMCore/ConstantFold.h b/lib/VMCore/ConstantFold.h index 49aea11870..66ca8ff31a 100644 --- a/lib/VMCore/ConstantFold.h +++ b/lib/VMCore/ConstantFold.h @@ -28,11 +28,13 @@ namespace llvm { Constant *ConstantFoldCastInstruction( unsigned opcode, ///< The opcode of the cast const Constant *V, ///< The source constant - const Type *DestTy ///< The destination type + const Type *DestTy, ///< The destination type + bool locked = true ); Constant *ConstantFoldSelectInstruction(const Constant *Cond, const Constant *V1, - const Constant *V2); + const Constant *V2, + bool locked = true); Constant *ConstantFoldExtractElementInstruction(const Constant *Val, const Constant *Idx); Constant *ConstantFoldInsertElementInstruction(const Constant *Val, @@ -49,12 +51,13 @@ namespace llvm { const unsigned* Idxs, unsigned NumIdx); Constant *ConstantFoldBinaryInstruction(unsigned Opcode, const Constant *V1, - const Constant *V2); + const Constant *V2, + bool locked = true); Constant *ConstantFoldCompareInstruction(unsigned short predicate, const Constant *C1, const Constant *C2); - Constant *ConstantFoldGetElementPtr(const Constant *C, - Constant* const *Idxs, unsigned NumIdx); + Constant *ConstantFoldGetElementPtr(const Constant *C, Constant* const *Idxs, + unsigned NumIdx, bool locked = true); } // End llvm namespace #endif |