[PATCH] D24533: Fix auto-upgrade of TBAA tags in Bitcode Reader

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 14 15:19:02 PDT 2016


> On 2016-Sep-13, at 20:47, Mehdi AMINI <mehdi.amini at apple.com> wrote:
> 
> mehdi_amini updated this revision to Diff 71294.
> mehdi_amini added a comment.
> 
> Cleanup!
> 
> 
> https://reviews.llvm.org/D24533
> 
> Files:
>  include/llvm/IR/AutoUpgrade.h
>  lib/AsmParser/LLParser.cpp
>  lib/Bitcode/Reader/BitcodeReader.cpp
>  lib/IR/AutoUpgrade.cpp
>  test/LTO/X86/Inputs/remangle_intrinsics_tbaa.ll
>  test/LTO/X86/remangle_intrinsics_tbaa.ll
>  tools/llvm-link/llvm-link.cpp
> 
> <D24533.71294.patch>

This LGTM, with two more nitpicks below.

> Index: lib/IR/AutoUpgrade.cpp
> ===================================================================
> --- lib/IR/AutoUpgrade.cpp
> +++ lib/IR/AutoUpgrade.cpp
> @@ -1462,28 +1462,25 @@
>    }
>  }
>  
> -void llvm::UpgradeInstWithTBAATag(Instruction *I) {
> -  MDNode *MD = I->getMetadata(LLVMContext::MD_tbaa);
> -  assert(MD && "UpgradeInstWithTBAATag should have a TBAA tag");
> +MDNode *llvm::UpgradeTBAANode(LLVMContext &Context, MDNode *MD) {

I think MD->getContext() will work; no need to pass in the LLVMContext.

Also, I think you should take in `MDNode &MD` instead of `MDNode*`.

>    // Check if the tag uses struct-path aware TBAA format.
>    if (isa<MDNode>(MD->getOperand(0)) && MD->getNumOperands() >= 3)
> -    return;
> +    return MD;
>  



More information about the llvm-commits mailing list