InstSimplify: Optimize away useless unsigned comparisons

Code like X < Y && Y == 0 should always be folded away to false.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223583 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer
2014-12-06 10:51:40 +00:00
parent c589098319
commit 620e8763ec
3 changed files with 98 additions and 1 deletions

View File

@ -1350,7 +1350,7 @@ static ICmpInst::Predicate areGlobalsPotentiallyEqual(const GlobalValue *GV1,
const GlobalValue *GV2) {
// Don't try to decide equality of aliases.
if (!isa<GlobalAlias>(GV1) && !isa<GlobalAlias>(GV2))
if (!GV1->hasExternalWeakLinkage() || !GV2->hasExternalWeakLinkage())
if (!GV1->hasExternalWeakLinkage() && !GV2->hasExternalWeakLinkage())
return ICmpInst::ICMP_NE;
return ICmpInst::BAD_ICMP_PREDICATE;
}