Skip to content

known constant not folded: new() + 4 != 0 #11613

@zygoloid

Description

@zygoloid
mannequin
Bugzilla Link 11241
Version trunk
OS Linux
Attachments Testcase
CC @chandlerc,@nlewycky

Extended Description

This IR:

  %alloc2 = tail call noalias i8* @​_Znwm(i64 8) nounwind
  %add = getelementptr inbounds i8* %alloc2, i64 4
  %always_false = icmp eq i8* %add, null
  ret i1 %always_false

... is collapsed to "ret i1 0". However, this IR:

  %alloc2 = tail call noalias i8* @​_Znwm(i64 8) nounwind
  %add = getelementptr inbounds i8* %alloc2, i64 4
  %always_false = icmp eq i8* %add, null
  br i1 %always_false, label %skipinit2, label %init2

init2:                                            ; preds = %entry
  store i8 1, i8* %alloc2, align 1
  ret void

skipinit2:                                        ; preds = %entry
  ret void

... is not optimized any further.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaincompleteIssue not complete (e.g. missing a reproducer, build arguments, etc.)llvm:optimizations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions