Index: llvm/lib/CodeGen/BreakFalseDeps.cpp =================================================================== --- llvm/lib/CodeGen/BreakFalseDeps.cpp +++ llvm/lib/CodeGen/BreakFalseDeps.cpp @@ -9,11 +9,11 @@ /// \file Break False Dependency pass. /// /// Some instructions have false dependencies which cause unnecessary stalls. -/// For exmaple, instructions that only write part of a register, and implicitly +/// For example, instructions that only write part of a register, and implicitly /// need to read the other parts of the register. This may cause unwanted /// stalls preventing otherwise unrelated instructions from executing in /// parallel in an out-of-order CPU. -/// This pass is aimed at identifying and avoiding these depepndencies when +/// This pass is aimed at identifying and avoiding these dependencies when /// possible. // //===----------------------------------------------------------------------===// @@ -252,6 +252,12 @@ bool BreakFalseDeps::runOnMachineFunction(MachineFunction &mf) { if (skipFunction(mf.getFunction())) return false; + + // This pass adds instructions to remove dependencies. That opposes the goal + // of minimizing size. + if (mf.getFunction().hasMinSize()) + return false; + MF = &mf; TII = MF->getSubtarget().getInstrInfo(); TRI = MF->getSubtarget().getRegisterInfo(); Index: llvm/test/CodeGen/X86/sqrt-partial.ll =================================================================== --- llvm/test/CodeGen/X86/sqrt-partial.ll +++ llvm/test/CodeGen/X86/sqrt-partial.ll @@ -44,7 +44,6 @@ ; CHECK-NEXT: mulsd %xmm0, %xmm0 ; CHECK-NEXT: mulsd %xmm1, %xmm1 ; CHECK-NEXT: addsd %xmm0, %xmm1 -; CHECK-NEXT: xorps %xmm0, %xmm0 ; CHECK-NEXT: sqrtsd %xmm1, %xmm0 ; CHECK-NEXT: retq %t3 = fmul fast double %x, %x Index: llvm/test/CodeGen/X86/stack-folding-fp-sse42.ll =================================================================== --- llvm/test/CodeGen/X86/stack-folding-fp-sse42.ll +++ llvm/test/CodeGen/X86/stack-folding-fp-sse42.ll @@ -583,7 +583,6 @@ ; CHECK-NEXT: #APP ; CHECK-NEXT: nop ; CHECK-NEXT: #NO_APP -; CHECK-NEXT: xorps %xmm0, %xmm0 ; CHECK-NEXT: cvtsd2ss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 8-byte Folded Reload ; CHECK-NEXT: retq %1 = tail call <2 x i64> asm sideeffect "nop", "=x,~{xmm1},~{xmm2},~{xmm3},~{xmm4},~{xmm5},~{xmm6},~{xmm7},~{xmm8},~{xmm9},~{xmm10},~{xmm11},~{xmm12},~{xmm13},~{xmm14},~{xmm15},~{flags}"() @@ -975,7 +974,6 @@ ; CHECK-NEXT: #APP ; CHECK-NEXT: nop ; CHECK-NEXT: #NO_APP -; CHECK-NEXT: xorps %xmm0, %xmm0 ; CHECK-NEXT: cvtss2sd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Folded Reload ; CHECK-NEXT: retq %1 = tail call <2 x i64> asm sideeffect "nop", "=x,~{xmm1},~{xmm2},~{xmm3},~{xmm4},~{xmm5},~{xmm6},~{xmm7},~{xmm8},~{xmm9},~{xmm10},~{xmm11},~{xmm12},~{xmm13},~{xmm14},~{xmm15},~{flags}"() @@ -2012,7 +2010,6 @@ ; CHECK-NEXT: #APP ; CHECK-NEXT: nop ; CHECK-NEXT: #NO_APP -; CHECK-NEXT: xorps %xmm0, %xmm0 ; CHECK-NEXT: roundss $9, {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Folded Reload ; CHECK-NEXT: retq %1 = tail call <2 x i64> asm sideeffect "nop", "=x,~{xmm1},~{xmm2},~{xmm3},~{xmm4},~{xmm5},~{xmm6},~{xmm7},~{xmm8},~{xmm9},~{xmm10},~{xmm11},~{xmm12},~{xmm13},~{xmm14},~{xmm15},~{flags}"() @@ -2181,7 +2178,6 @@ ; CHECK-NEXT: #APP ; CHECK-NEXT: nop ; CHECK-NEXT: #NO_APP -; CHECK-NEXT: xorps %xmm0, %xmm0 ; CHECK-NEXT: sqrtss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Folded Reload ; CHECK-NEXT: retq %1 = tail call <2 x i64> asm sideeffect "nop", "=x,~{xmm1},~{xmm2},~{xmm3},~{xmm4},~{xmm5},~{xmm6},~{xmm7},~{xmm8},~{xmm9},~{xmm10},~{xmm11},~{xmm12},~{xmm13},~{xmm14},~{xmm15},~{flags}"()