Skip to content

[InstCombine] Failure to simplify add-of-negative+underflow check+null check of non-null base pointer #42604

@LebedevRI

Description

@LebedevRI
Bugzilla Link 43259
Version trunk
OS Linux
CC @RKSimon,@nikic,@rotateright,@vedantk
Fixed by commit(s) 372491, 372767, 372768

Extended Description

Again comes up in https://reviews.llvm.org/D67122
Much like what we have in 43251,
for

#include <cassert>
char* test(char& base, signed long offset) {
  __builtin_assume(offset < 0);
  return &base + offset;
}

We produce

https://godbolt.org/z/r40U47

and again those two icmp's can be merged:
https://rise4fun.com/Alive/8h2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillallvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions