diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-12-09 18:39:32 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-12-09 18:39:32 +0000 |
commit | fb494914779d4e2b86b038a1491138d305e46789 (patch) | |
tree | a2d3d2e3ced8ad76719bb8128792c26d767d85a7 /clang/lib/CodeGen/CGStmt.cpp | |
parent | 5bf8fef58013e2c97180236fa6973faa40435d5f (diff) | |
download | bcm5719-llvm-fb494914779d4e2b86b038a1491138d305e46789.tar.gz bcm5719-llvm-fb494914779d4e2b86b038a1491138d305e46789.zip |
IR: Update clang for Metadata/Value split in r223802
Match LLVM API changes from r223802.
llvm-svn: 223803
Diffstat (limited to 'clang/lib/CodeGen/CGStmt.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 835f043a924..a003e8ab9e8 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -591,7 +591,9 @@ void CodeGenFunction::EmitCondBrHints(llvm::LLVMContext &Context, return; // Add vectorize and unroll hints to the metadata on the conditional branch. - SmallVector<llvm::Value *, 2> Metadata(1); + // + // FIXME: Should this really start with a size of 1? + SmallVector<llvm::Metadata *, 2> Metadata(1); for (const auto *Attr : Attrs) { const LoopHintAttr *LH = dyn_cast<LoopHintAttr>(Attr); @@ -629,7 +631,7 @@ void CodeGenFunction::EmitCondBrHints(llvm::LLVMContext &Context, ValueInt = static_cast<int>(ValueAPS.getSExtValue()); } - llvm::Value *Value; + llvm::Constant *Value; llvm::MDString *Name; switch (Option) { case LoopHintAttr::Vectorize: @@ -656,15 +658,16 @@ void CodeGenFunction::EmitCondBrHints(llvm::LLVMContext &Context, break; } - SmallVector<llvm::Value *, 2> OpValues; + SmallVector<llvm::Metadata *, 2> OpValues; OpValues.push_back(Name); if (Value) - OpValues.push_back(Value); + OpValues.push_back(llvm::ConstantAsMetadata::get(Value)); // Set or overwrite metadata indicated by Name. Metadata.push_back(llvm::MDNode::get(Context, OpValues)); } + // FIXME: This condition is never false. Should it be an assert? if (!Metadata.empty()) { // Add llvm.loop MDNode to CondBr. llvm::MDNode *LoopID = llvm::MDNode::get(Context, Metadata); @@ -1766,10 +1769,10 @@ llvm::Value* CodeGenFunction::EmitAsmInput( /// asm. static llvm::MDNode *getAsmSrcLocInfo(const StringLiteral *Str, CodeGenFunction &CGF) { - SmallVector<llvm::Value *, 8> Locs; + SmallVector<llvm::Metadata *, 8> Locs; // Add the location of the first line to the MDNode. - Locs.push_back(llvm::ConstantInt::get(CGF.Int32Ty, - Str->getLocStart().getRawEncoding())); + Locs.push_back(llvm::ConstantAsMetadata::get(llvm::ConstantInt::get( + CGF.Int32Ty, Str->getLocStart().getRawEncoding()))); StringRef StrVal = Str->getString(); if (!StrVal.empty()) { const SourceManager &SM = CGF.CGM.getContext().getSourceManager(); @@ -1781,8 +1784,8 @@ static llvm::MDNode *getAsmSrcLocInfo(const StringLiteral *Str, if (StrVal[i] != '\n') continue; SourceLocation LineLoc = Str->getLocationOfByte(i+1, SM, LangOpts, CGF.getTarget()); - Locs.push_back(llvm::ConstantInt::get(CGF.Int32Ty, - LineLoc.getRawEncoding())); + Locs.push_back(llvm::ConstantAsMetadata::get( + llvm::ConstantInt::get(CGF.Int32Ty, LineLoc.getRawEncoding()))); } } @@ -2052,7 +2055,9 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { } else { // At least put the line number on MS inline asm blobs. auto Loc = llvm::ConstantInt::get(Int32Ty, S.getAsmLoc().getRawEncoding()); - Result->setMetadata("srcloc", llvm::MDNode::get(getLLVMContext(), Loc)); + Result->setMetadata("srcloc", + llvm::MDNode::get(getLLVMContext(), + llvm::ConstantAsMetadata::get(Loc))); } // Extract all of the register value results from the asm. |