SimplifyCFG currently drops !nontemporal metadata when sinking common instructions. With this change, SimplifyCFG and similar transforms will preserve !nontemporal metadata as long as it is set on both original instructions. Differential Revision: https://reviews.llvm.org/D144298
31 lines
906 B
LLVM
31 lines
906 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt -passes=gvn -S < %s | FileCheck %s
|
|
|
|
; Check that !nontemporal metadata is preserved only if both original
|
|
; instructions are marked.
|
|
define i64 @one_nontemporal(ptr %p) {
|
|
; CHECK-LABEL: @one_nontemporal(
|
|
; CHECK-NEXT: [[A:%.*]] = load i64, ptr [[P:%.*]], align 4
|
|
; CHECK-NEXT: [[C:%.*]] = add i64 [[A]], [[A]]
|
|
; CHECK-NEXT: ret i64 [[C]]
|
|
;
|
|
%a = load i64, ptr %p
|
|
%b = load i64, ptr %p, !nontemporal !0
|
|
%c = add i64 %a, %b
|
|
ret i64 %c
|
|
}
|
|
|
|
define i64 @both_nontemporal(ptr %p) {
|
|
; CHECK-LABEL: @both_nontemporal(
|
|
; CHECK-NEXT: [[A:%.*]] = load i64, ptr [[P:%.*]], align 4, !nontemporal !0
|
|
; CHECK-NEXT: [[C:%.*]] = add i64 [[A]], [[A]]
|
|
; CHECK-NEXT: ret i64 [[C]]
|
|
;
|
|
%a = load i64, ptr %p, !nontemporal !0
|
|
%b = load i64, ptr %p, !nontemporal !0
|
|
%c = add i64 %a, %b
|
|
ret i64 %c
|
|
}
|
|
|
|
!0 = !{i32 1}
|