Skip to content

InstCombine incorrectly shrinks the size of store #43651

Description

@aqjune
Bugzilla Link 44306
Resolution FIXED
Resolved on Dec 16, 2019 12:15
Version trunk
OS All
Attachments input.ll
CC @alexey-bataev,@topperc,@LebedevRI,@RKSimon,@nunoplopes,@rotateright
Fixed by commit(s) 02f644c

Extended Description

$ cat input.ll
define void @​#37526 (i32* %pz, i32* %px, i32* %py) {
  %t2 = load i32, i32* %py
  %t3 = load i32, i32* %px
  %cmp = icmp slt i32 %t2, %t3
  %select = select i1 %cmp, i32* %px, i32* %py
  %bc = bitcast i32* %select to i64*
  %r = load i64, i64* %bc
  %t1 = bitcast i32* %pz to i64*
  store i64 %r, i64* %t1
  ret void
}

$ opt -instcombine -S -o - input.ll
define void @​#37526 (i32* %pz, i32* %px, i32* %py) {
  %t2 = load i32, i32* %py, align 4
  %t3 = load i32, i32* %px, align 4
  %cmp = icmp slt i32 %t2, %t3
  %r1 = select i1 %cmp, i32 %t3, i32 %t2
  store i32 %r1, i32* %pz, align 4
  ret void
}

After InstCombine, the i64 store in source is shrinked into i32 store, which is incorrect.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions