[llvm] r220995 - IR: Instruction::setMetadata() should use cast_or_null
Duncan P. N. Exon Smith
dexonsmith at apple.com
Fri Oct 31 13:28:04 PDT 2014
Author: dexonsmith
Date: Fri Oct 31 15:28:04 2014
New Revision: 220995
URL: http://llvm.org/viewvc/llvm-project?rev=220995&view=rev
Log:
IR: Instruction::setMetadata() should use cast_or_null
Not sure why this assertion didn't fire locally [1], but in r220994
`Instruction::setMetadata()` should be using `cast_or_null`.
[1]: http://lab.llvm.org:8011/builders/llvm-hexagon-elf/builds/12327
Modified:
llvm/trunk/lib/IR/Metadata.cpp
Modified: llvm/trunk/lib/IR/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Metadata.cpp?rev=220995&r1=220994&r2=220995&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Metadata.cpp (original)
+++ llvm/trunk/lib/IR/Metadata.cpp Fri Oct 31 15:28:04 2014
@@ -660,7 +660,7 @@ void Instruction::setMetadata(unsigned K
if (!MD && !hasMetadata()) return;
// For now, we only expect MDNodes here.
- MDNode *Node = cast<MDNode>(MD);
+ MDNode *Node = cast_or_null<MDNode>(MD);
// Handle 'dbg' as a special case since it is not stored in the hash table.
if (KindID == LLVMContext::MD_dbg) {
More information about the llvm-commits
mailing list