https://bugs.llvm.org/show_bug.cgi?id=50697

            Bug ID: 50697
           Summary: InstCombine breaks calls of casted functions with type
                    attributes
           Product: libraries
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

In LLVM 12.0.0, InstCombine can break call instructions of casted functions
when type attributes (byval, sret, etc.) are involved. Example input:


%struct0 = type { i32 }
%struct1 = type { float }

declare void @callee(%struct0* sret(%struct0))

define void @caller() {
  %1 = alloca %struct1
  call void bitcast (void (%struct0*)* @callee to void (%struct1*)*)(%struct1*
sret(%struct1) %1)
  unreachable
}


When run through `opt -S -instcombine`, the output is:


%struct0 = type { i32 }

declare void @callee(%struct0* sret(%struct0))

define void @caller() {
  %1 = alloca %struct0, align 8
  call void @callee(%struct0* nonnull sret(%struct1) %1)
  unreachable
}


This is invalid because the argument type (%struct0*) no longer matches the
attribute type (%struct1).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to