There is a bug in getInductionVariable. From code, the way this function gets the induction variable is by judging whether StepInst or IndVar in the phi statement is one of the operands of CMP. It will perform dyn_cast operations. But if the LatchCmpOp0/LatchCmpOp1 is a constant, it will be cast to null. The same situation exists when getting the Stepinst, the subsequent comparison may result in null == null, which is meaningless. The induction variable will be the first phi of the loop, and this does not match the logic of this function.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
The induction variable will be the first phi of the loop, and this does not match the logic of this function.
Is the code relying on the IV being the first phi in the loop? That is not a guarantee that can be relied on I think.
llvm/lib/Analysis/LoopInfo.cpp | ||
---|---|---|
312–313 | nit: no need for this->? | |
llvm/unittests/Analysis/LoopInfoTest.cpp | ||
1551 | Can you clean up the IR? There are multiple things that should not be needed, like "; Function Attrs: dso_local sigext the metadata and more. |
nit: no need for this->?