diff options
author | Sanjay Patel <spatel@rotateright.com> | 2019-03-21 13:57:07 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2019-03-21 13:57:07 +0000 |
commit | d47eac59efb1de3a4fe797c54e116de55c6559e2 (patch) | |
tree | d01067880b29bb2565aecd1536fd1141e9467596 /llvm/test/Transforms/CodeGenPrepare/X86 | |
parent | 3e9e55491e787b9c1a100a58c27b5e228a278942 (diff) | |
download | bcm5719-llvm-d47eac59efb1de3a4fe797c54e116de55c6559e2.tar.gz bcm5719-llvm-d47eac59efb1de3a4fe797c54e116de55c6559e2.zip |
[CodeGenPrepare] limit formation of overflow intrinsics (PR41129)
This is probably a bigger limitation than necessary, but since we don't have any evidence yet
that this transform led to real-world perf improvements rather than regressions, I'm making a
quick, blunt fix.
In the motivating x86 example from:
https://bugs.llvm.org/show_bug.cgi?id=41129
...and shown in the regression test, we want to avoid an extra instruction in the dominating
block because that could be costly.
The x86 LSR test diff is reversing the changes from D57789. There's no evidence that 1 version
is any better than the other yet.
Differential Revision: https://reviews.llvm.org/D59602
llvm-svn: 356665
Diffstat (limited to 'llvm/test/Transforms/CodeGenPrepare/X86')
-rw-r--r-- | llvm/test/Transforms/CodeGenPrepare/X86/overflow-intrinsics.ll | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/test/Transforms/CodeGenPrepare/X86/overflow-intrinsics.ll b/llvm/test/Transforms/CodeGenPrepare/X86/overflow-intrinsics.ll index e6686712653..ab636c39ddb 100644 --- a/llvm/test/Transforms/CodeGenPrepare/X86/overflow-intrinsics.ll +++ b/llvm/test/Transforms/CodeGenPrepare/X86/overflow-intrinsics.ll @@ -475,23 +475,22 @@ define i64 @foo2(i8 *%p) { ret i64 %sub } -; When the compare operand has uses besides add/sub, -; the transform may not be profitable. +; Avoid hoisting a math op into a dominating block which would +; increase the critical path. define void @PR41129(i64* %p64) { ; CHECK-LABEL: @PR41129( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[KEY:%.*]] = load i64, i64* [[P64:%.*]], align 8 -; CHECK-NEXT: [[TMP0:%.*]] = call { i64, i1 } @llvm.usub.with.overflow.i64(i64 [[KEY]], i64 1) -; CHECK-NEXT: [[MATH:%.*]] = extractvalue { i64, i1 } [[TMP0]], 0 -; CHECK-NEXT: [[OV:%.*]] = extractvalue { i64, i1 } [[TMP0]], 1 -; CHECK-NEXT: br i1 [[OV]], label [[TRUE:%.*]], label [[FALSE:%.*]] +; CHECK-NEXT: [[COND17:%.*]] = icmp eq i64 [[KEY]], 0 +; CHECK-NEXT: br i1 [[COND17]], label [[TRUE:%.*]], label [[FALSE:%.*]] ; CHECK: false: ; CHECK-NEXT: [[ANDVAL:%.*]] = and i64 [[KEY]], 7 ; CHECK-NEXT: store i64 [[ANDVAL]], i64* [[P64]] ; CHECK-NEXT: br label [[EXIT:%.*]] ; CHECK: true: -; CHECK-NEXT: store i64 [[MATH]], i64* [[P64]] +; CHECK-NEXT: [[SVALUE:%.*]] = add i64 [[KEY]], -1 +; CHECK-NEXT: store i64 [[SVALUE]], i64* [[P64]] ; CHECK-NEXT: br label [[EXIT]] ; CHECK: exit: ; CHECK-NEXT: ret void |