[PATCH] D25215: [InstCombine] Transform !range metadata to !nonnull when combining loads
Hal Finkel via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 3 16:48:24 PDT 2016
hfinkel added inline comments.
> InstCombineLoadStoreAlloca.cpp:386
> + // If it's a pointer now and the range does not contain 0, make it !nonnull.
> + if (NewTy->isPointerTy() && N->getNumOperands() == 2) {
> + unsigned int BitWidth = IC.getDataLayout().getTypeSizeInBits(NewTy);
What is the:
N->getNumOperands() == 2
supposed to be checking? The range metadata can have any even number of operands; and we already have an assert for this in llvm::getConstantRangeFromMetadata.
> InstCombineLoadStoreAlloca.cpp:387
> + if (NewTy->isPointerTy() && N->getNumOperands() == 2) {
> + unsigned int BitWidth = IC.getDataLayout().getTypeSizeInBits(NewTy);
> + if (!getConstantRangeFromMetadata(*N).contains(APInt(BitWidth, 0))) {
Indentation looks odd here. Tabs?
> PR30597.ll:23
> + ret i32 42
> +}
> +
This is a nice test case, and I'd keep that, but can you also add a more-direct test case involving the range metadata directly?
Repository:
rL LLVM
https://reviews.llvm.org/D25215
More information about the llvm-commits
mailing list