[PATCH] D71660: [ValueTracking] isKnownNonZero() should take non-null-ness assumptions into consideration (PR43267)
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 19 13:42:30 PST 2019
nikic added inline comments.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:572
+ // the control flow, not even CxtI itself.
+ for (BasicBlock::const_iterator I = BasicBlock::const_iterator(CxtI), IE(Inv);
I != IE; ++I)
----------------
Does just `BasicBlock::const_iterator I(CxtI), IE(Inv);` work?
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:611
+ ConstantInt *CI;
+ if (!match(RHS, m_ConstantInt(CI)))
+ return false;
----------------
Any particular reason to use m_ConstantInt() over m_APInt() here? The difference in vector handling?
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:636
+ Value *Arg = I->getArgOperand(0);
+
+ ICmpInst *Cmp = dyn_cast<ICmpInst>(Arg);
----------------
nit: Unnecessary newline.
================
Comment at: llvm/test/Transforms/InstCombine/assume.ll:272
; CHECK: taken:
+; CHECK-NEXT: [[LOAD:%.*]] = load i32*, i32** [[A:%.*]], align 8
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32* [[LOAD]], null
----------------
I'm assuming that we first evaluate the icmp below, then the load is one-use and gets sunk. I'm wondering why the assume is not converted into `!nonnull` metadata after that, as the control dependence is now gone.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71660/new/
https://reviews.llvm.org/D71660
More information about the llvm-commits
mailing list