[all-commits] [llvm/llvm-project] 1e5f81: [InstCombine] Fix infinite recursion in ashr/xor v...
David Green via All-commits
all-commits at lists.llvm.org
Thu Nov 4 02:24:39 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 1e5f814302f8c24bdcc6f79623b86bd32231278f
https://github.com/llvm/llvm-project/commit/1e5f814302f8c24bdcc6f79623b86bd32231278f
Author: David Green <david.green at arm.com>
Date: 2021-11-04 (Thu, 04 Nov 2021)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
M llvm/test/Transforms/InstCombine/xor-ashr.ll
Log Message:
-----------
[InstCombine] Fix infinite recursion in ashr/xor vector fold.
The added test has poison lanes due to the vector shuffle. This can
cause an infinite loop of combines in instcombine where it folds
xor(ashr, -1) -> select (icmp slt 0), -1, 0 -> sext (icmp slt 0) -> xor(ashr, -1).
We usually prevent this by checking that the xor constant is not -1,
but with vectors some of the lanes may be -1, some may be poison. So
this changes the way we detect that from "!C1->isAllOnesValue()" to
"!match(C1, m_AllOnes())", which is more able to detect that some of the
lanes are poison.
Fixes PR52397
More information about the All-commits
mailing list