[llvm] r365202 - This reverts r365061 and r365062 (test update)

Robert Lougher via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 5 05:42:06 PDT 2019


Author: rlougher
Date: Fri Jul  5 05:42:06 2019
New Revision: 365202

URL: http://llvm.org/viewvc/llvm-project?rev=365202&view=rev
Log:
This reverts r365061 and r365062 (test update)

Revision r365061 changed a skip of debug instructions for a skip
of meta instructions. This is not safe, as IMPLICIT_DEF is classed
as a meta instruction.


Removed:
    llvm/trunk/test/CodeGen/X86/avoid-sfb-ignore-meta.mir
Modified:
    llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
    llvm/trunk/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp
    llvm/trunk/test/CodeGen/X86/pr38743.ll

Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=365202&r1=365201&r2=365202&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Fri Jul  5 05:42:06 2019
@@ -947,28 +947,6 @@ inline IterT skipDebugInstructionsBackwa
   return It;
 }
 
-/// Increment \p It until it points to a non-meta instruction or to \p End
-/// and return the resulting iterator. This function should only be used
-/// MachineBasicBlock::{iterator, const_iterator, instr_iterator,
-/// const_instr_iterator} and the respective reverse iterators.
-template <typename IterT>
-inline IterT skipMetaInstructionsForward(IterT It, IterT End) {
-  while (It != End && It->isMetaInstruction())
-    It++;
-  return It;
-}
-
-/// Decrement \p It until it points to a non-meta instruction or to \p Begin
-/// and return the resulting iterator. This function should only be used
-/// MachineBasicBlock::{iterator, const_iterator, instr_iterator,
-/// const_instr_iterator} and the respective reverse iterators.
-template <class IterT>
-inline IterT skipMetaInstructionsBackward(IterT It, IterT Begin) {
-  while (It != Begin && It->isMetaInstruction())
-    It--;
-  return It;
-}
-
 } // end namespace llvm
 
 #endif // LLVM_CODEGEN_MACHINEBASICBLOCK_H

Modified: llvm/trunk/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp?rev=365202&r1=365201&r2=365202&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp Fri Jul  5 05:42:06 2019
@@ -408,7 +408,7 @@ void X86AvoidSFBPass::buildCopy(MachineI
   // If the load and store are consecutive, use the loadInst location to
   // reduce register pressure.
   MachineInstr *StInst = StoreInst;
-  auto PrevInstrIt = skipMetaInstructionsBackward(
+  auto PrevInstrIt = skipDebugInstructionsBackward(
       std::prev(MachineBasicBlock::instr_iterator(StoreInst)),
       MBB->instr_begin());
   if (PrevInstrIt.getNodePtr() == LoadInst)
@@ -496,7 +496,7 @@ void X86AvoidSFBPass::buildCopies(int Si
 static void updateKillStatus(MachineInstr *LoadInst, MachineInstr *StoreInst) {
   MachineOperand &LoadBase = getBaseOperand(LoadInst);
   MachineOperand &StoreBase = getBaseOperand(StoreInst);
-  auto StorePrevNonMetaInstr = skipMetaInstructionsBackward(
+  auto StorePrevNonDbgInstr = skipDebugInstructionsBackward(
           std::prev(MachineBasicBlock::instr_iterator(StoreInst)),
           LoadInst->getParent()->instr_begin()).getNodePtr();
   if (LoadBase.isReg()) {
@@ -505,13 +505,13 @@ static void updateKillStatus(MachineInst
     // then the partial copies were also created in
     // a consecutive order to reduce register pressure,
     // and the location of the last load is before the last store.
-    if (StorePrevNonMetaInstr == LoadInst)
+    if (StorePrevNonDbgInstr == LoadInst)
       LastLoad = LoadInst->getPrevNode()->getPrevNode();
     getBaseOperand(LastLoad).setIsKill(LoadBase.isKill());
   }
   if (StoreBase.isReg()) {
     MachineInstr *StInst = StoreInst;
-    if (StorePrevNonMetaInstr == LoadInst)
+    if (StorePrevNonDbgInstr == LoadInst)
       StInst = LoadInst;
     getBaseOperand(StInst->getPrevNode()).setIsKill(StoreBase.isKill());
   }

Removed: llvm/trunk/test/CodeGen/X86/avoid-sfb-ignore-meta.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avoid-sfb-ignore-meta.mir?rev=365201&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avoid-sfb-ignore-meta.mir (original)
+++ llvm/trunk/test/CodeGen/X86/avoid-sfb-ignore-meta.mir (removed)
@@ -1,155 +0,0 @@
-# RUN: llc %s -run-pass x86-avoid-SFB -mtriple=x86_64-unknown-linux-gnu -o - | FileCheck %s
-#
-# This was generated from:
-#
-# using alpha = float __attribute__((ext_vector_type(4)));
-#
-# void bravo(alpha * __restrict__ p1, alpha * __restrict__ p2) {
-#   char *p3 = (char *)p1;
-#   *p3 = 0;
-#   alpha t = *p1;
-#   *p2 = t;
-# }
-#
-# Using the command line:
-# clang -g -c 1.cpp -O2 -S -emit-llvm -fno-strict-aliasing --target=x86_64-unknown-unknown -o test.ll
-# llc -stop-before=x86-avoid-SFB test.ll -o before.mir
-#
-# The debug instruction between the load and the store has been manually replaced with a CFI meta instruction.
-
---- |
-  ; ModuleID = 'test.ll'
-  source_filename = "1.cpp"
-  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-  target triple = "x86_64-unknown-unknown"
-
-  ; Function Attrs: norecurse nounwind uwtable
-  define dso_local void @debug(<4 x float>* noalias nocapture %p1, <4 x float>* noalias nocapture %p2) local_unnamed_addr !dbg !10 {
-  entry:
-    call void @llvm.dbg.value(metadata <4 x float>* %p1, metadata !21, metadata !DIExpression()), !dbg !25
-    call void @llvm.dbg.value(metadata <4 x float>* %p2, metadata !22, metadata !DIExpression()), !dbg !25
-    %0 = bitcast <4 x float>* %p1 to i8*, !dbg !26
-    call void @llvm.dbg.value(metadata i8* %0, metadata !23, metadata !DIExpression()), !dbg !25
-    store i8 0, i8* %0, align 1, !dbg !27
-    %1 = load <4 x float>, <4 x float>* %p1, align 16, !dbg !28
-    call void @llvm.dbg.value(metadata <4 x float> %1, metadata !24, metadata !DIExpression()), !dbg !25
-    store <4 x float> %1, <4 x float>* %p2, align 16, !dbg !29
-    ret void, !dbg !30
-  }
-
-  ; Function Attrs: nounwind readnone speculatable
-  declare void @llvm.dbg.value(metadata, metadata, metadata)
-
-  ; Function Attrs: nounwind
-  declare void @llvm.stackprotector(i8*, i8**)
-
-  !llvm.dbg.cu = !{!0}
-  !llvm.module.flags = !{!6, !7, !8}
-  !llvm.ident = !{!9}
-
-  !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 9.0.0 (https://github.com/llvm/llvm-project.git 9afc4764dd24bd2f23c44e51ad33f8e58234a8b6)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)
-  !1 = !DIFile(filename: "1.cpp", directory: "C:\5CUsers\5Cgbdawsoc\5CDocuments\5Cllvm\5Cbg40969")
-  !2 = !{}
-  !3 = !{!4}
-  !4 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !5, size: 64)
-  !5 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
-  !6 = !{i32 2, !"Dwarf Version", i32 4}
-  !7 = !{i32 2, !"Debug Info Version", i32 3}
-  !8 = !{i32 1, !"wchar_size", i32 4}
-  !9 = !{!"clang version 9.0.0 (https://github.com/llvm/llvm-project.git 9afc4764dd24bd2f23c44e51ad33f8e58234a8b6)"}
-  !10 = distinct !DISubprogram(name: "bravo", linkageName: "_Z5bravoPDv4_fS0_", scope: !1, file: !1, line: 4, type: !11, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !20)
-  !11 = !DISubroutineType(types: !12)
-  !12 = !{null, !13, !13}
-  !13 = !DIDerivedType(tag: DW_TAG_restrict_type, baseType: !14)
-  !14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !15, size: 64)
-  !15 = !DIDerivedType(tag: DW_TAG_typedef, name: "alpha", file: !1, line: 2, baseType: !16)
-  !16 = !DICompositeType(tag: DW_TAG_array_type, baseType: !17, size: 128, flags: DIFlagVector, elements: !18)
-  !17 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
-  !18 = !{!19}
-  !19 = !DISubrange(count: 4)
-  !20 = !{!21, !22, !23, !24}
-  !21 = !DILocalVariable(name: "p1", arg: 1, scope: !10, file: !1, line: 4, type: !13)
-  !22 = !DILocalVariable(name: "p2", arg: 2, scope: !10, file: !1, line: 4, type: !13)
-  !23 = !DILocalVariable(name: "p3", scope: !10, file: !1, line: 5, type: !4)
-  !24 = !DILocalVariable(name: "t", scope: !10, file: !1, line: 7, type: !15)
-  !25 = !DILocation(line: 0, scope: !10)
-  !26 = !DILocation(line: 5, column: 14, scope: !10)
-  !27 = !DILocation(line: 6, column: 7, scope: !10)
-  !28 = !DILocation(line: 7, column: 13, scope: !10)
-  !29 = !DILocation(line: 8, column: 7, scope: !10)
-  !30 = !DILocation(line: 9, column: 1, scope: !10)
-
-...
----
-name:            debug
-alignment:       4
-exposesReturnsTwice: false
-legalized:       false
-regBankSelected: false
-selected:        false
-failedISel:      false
-tracksRegLiveness: true
-hasWinCFI:       false
-registers:
-  - { id: 0, class: gr64, preferred-register: '' }
-  - { id: 1, class: gr64, preferred-register: '' }
-  - { id: 2, class: vr128, preferred-register: '' }
-liveins:
-  - { reg: '$rdi', virtual-reg: '%0' }
-  - { reg: '$rsi', virtual-reg: '%1' }
-frameInfo:
-  isFrameAddressTaken: false
-  isReturnAddressTaken: false
-  hasStackMap:     false
-  hasPatchPoint:   false
-  stackSize:       0
-  offsetAdjustment: 0
-  maxAlignment:    0
-  adjustsStack:    false
-  hasCalls:        false
-  stackProtector:  ''
-  maxCallFrameSize: 4294967295
-  cvBytesOfCalleeSavedRegisters: 0
-  hasOpaqueSPAdjustment: false
-  hasVAStart:      false
-  hasMustTailInVarArgFunc: false
-  localFrameSize:  0
-  savePoint:       ''
-  restorePoint:    ''
-fixedStack:      []
-stack:           []
-constants:       []
-machineFunctionInfo: {}
-body:             |
-  bb.0.entry:
-    liveins: $rdi, $rsi
-
-    DBG_VALUE $rdi, $noreg, !21, !DIExpression(), debug-location !25
-    DBG_VALUE $rsi, $noreg, !22, !DIExpression(), debug-location !25
-    %1:gr64 = COPY $rsi
-    DBG_VALUE %1, $noreg, !22, !DIExpression(), debug-location !25
-    %0:gr64 = COPY $rdi
-    DBG_VALUE %0, $noreg, !21, !DIExpression(), debug-location !25
-    DBG_VALUE %0, $noreg, !23, !DIExpression(), debug-location !25
-    MOV8mi %0, 1, $noreg, 0, $noreg, 0, debug-location !27 :: (store 1 into %ir.0)    
-    %2:vr128 = MOVAPSrm %0, 1, $noreg, 0, $noreg, debug-location !28 :: (load 16 from %ir.p1)
-    CFI_INSTRUCTION offset $r13, -123
-    MOVAPSmr %1, 1, $noreg, 0, $noreg, killed %2, debug-location !29 :: (store 16 into %ir.p2)
-    RET 0, debug-location !30
-
-    ; CHECK-LABEL: name: debug
-    ; CHECK: %1:gr64 = COPY
-    ; CHECK: %0:gr64 = COPY
-    ; CHECK: MOV8mi
-    ; CHECK: %3:gr8 = MOV8rm
-    ; CHECK: MOV8mr
-    ; CHECK: %4:gr64 = MOV64rm
-    ; CHECK: MOV64mr
-    ; CHECK: %5:gr32 = MOV32rm
-    ; CHECK: MOV32mr
-    ; CHECK: %6:gr16 = MOV16rm
-    ; CHECK: MOV16mr
-    ; CHECK: %7:gr8 = MOV8rm
-    ; CHECK: MOV8mr
-    ; CHECK: RET 0
-...

Modified: llvm/trunk/test/CodeGen/X86/pr38743.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr38743.ll?rev=365202&r1=365201&r2=365202&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/pr38743.ll (original)
+++ llvm/trunk/test/CodeGen/X86/pr38743.ll Fri Jul  5 05:42:06 2019
@@ -41,15 +41,15 @@ define void @pr38743(i32 %a0) #1 align 2
 ; CHECK-NEXT:    movq -{{[0-9]+}}(%rsp), %rax
 ; CHECK-NEXT:    movq %rax, (%rax)
 ; CHECK-NEXT:    movb -{{[0-9]+}}(%rsp), %al
+; CHECK-NEXT:    movq -{{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    movzwl -{{[0-9]+}}(%rsp), %edx
+; CHECK-NEXT:    movl -{{[0-9]+}}(%rsp), %esi
+; CHECK-NEXT:    movb -{{[0-9]+}}(%rsp), %dil
 ; CHECK-NEXT:    movb %al, (%rax)
-; CHECK-NEXT:    movq -{{[0-9]+}}(%rsp), %rax
-; CHECK-NEXT:    movq %rax, 1(%rax)
-; CHECK-NEXT:    movzwl -{{[0-9]+}}(%rsp), %eax
-; CHECK-NEXT:    movw %ax, 9(%rax)
-; CHECK-NEXT:    movl -{{[0-9]+}}(%rsp), %eax
-; CHECK-NEXT:    movl %eax, 11(%rax)
-; CHECK-NEXT:    movb -{{[0-9]+}}(%rsp), %al
-; CHECK-NEXT:    movb %al, 15(%rax)
+; CHECK-NEXT:    movq %rcx, 1(%rax)
+; CHECK-NEXT:    movw %dx, 9(%rax)
+; CHECK-NEXT:    movl %esi, 11(%rax)
+; CHECK-NEXT:    movb %dil, 15(%rax)
 ; CHECK-NEXT:    retq
 bb:
   %tmp = alloca %0, align 16




More information about the llvm-commits mailing list