Files
clang-p2996/llvm/test/Transforms/IPConstantProp/PR43857.ll
Johannes Doerfert 07d16424f2 [Attributor][FIX] Do not try to cast if a cast is not required
When we replace constant returns at the call site we did issue a cast in
the hopes it would be a no-op if the types are equal. Turns out that is
not the case and we have to check it ourselves first.

Reused an IPConstantProp test for coverage. No functional change to the
test wrt. IPConstantProp.
2019-11-02 00:54:00 -05:00

36 lines
1.2 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -ipconstprop | FileCheck %s --check-prefixes=ALL,IPCP
; RUN: opt -S -passes=attributor -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=1 < %s | FileCheck %s --check-prefixes=ALL,ATTRIBUTOR
%struct.wobble = type { i32 }
%struct.zot = type { %struct.wobble, %struct.wobble, %struct.wobble }
declare dso_local fastcc float @bar(%struct.wobble* noalias, <8 x i32>) unnamed_addr
define %struct.zot @widget(<8 x i32> %arg) local_unnamed_addr {
; ALL-LABEL: @widget(
; ALL-NEXT: bb:
; ALL-NEXT: ret [[STRUCT_ZOT:%.*]] undef
;
bb:
ret %struct.zot undef
}
define void @baz(<8 x i32> %arg) local_unnamed_addr {
; IPCP-LABEL: @baz(
; IPCP-NEXT: bb:
; IPCP-NEXT: [[TMP:%.*]] = call [[STRUCT_ZOT:%.*]] @widget(<8 x i32> [[ARG:%.*]])
; IPCP-NEXT: [[TMP1:%.*]] = extractvalue [[STRUCT_ZOT]] %tmp, 0, 0
; IPCP-NEXT: ret void
;
; ATTRIBUTOR-LABEL: @baz(
; ATTRIBUTOR-NEXT: bb:
; ATTRIBUTOR-NEXT: [[TMP1:%.*]] = extractvalue [[STRUCT_ZOT:%.*]] undef, 0, 0
; ATTRIBUTOR-NEXT: ret void
;
bb:
%tmp = call %struct.zot @widget(<8 x i32> %arg)
%tmp1 = extractvalue %struct.zot %tmp, 0, 0
ret void
}