diff options
| author | Artur Pilipenko <apilipenko@azulsystems.com> | 2017-01-25 14:12:12 +0000 |
|---|---|---|
| committer | Artur Pilipenko <apilipenko@azulsystems.com> | 2017-01-25 14:12:12 +0000 |
| commit | e812ca00bbd50be94f9e0110be5f99b72b2efc07 (patch) | |
| tree | c8f6629ad29b090d2cf9507f6e2503b5ea572a5e /llvm/lib/Transforms/InstCombine | |
| parent | 91834227a3d58ecdb9e3f7300f587ab45c32ba06 (diff) | |
| download | bcm5719-llvm-e812ca00bbd50be94f9e0110be5f99b72b2efc07.tar.gz bcm5719-llvm-e812ca00bbd50be94f9e0110be5f99b72b2efc07.zip | |
[InstCombine] Allow InstrCombine to remove one of adjacent guards if they are equivalent
This is a partial fix for Bug 31520 - [guards] canonicalize guards in instcombine
Reviewed By: majnemer, apilipenko
Differential Revision: https://reviews.llvm.org/D29071
Patch by Maxim Kazantsev.
llvm-svn: 293056
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 6b03b682bca..679596766fc 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -2870,6 +2870,16 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { // TODO: relocate((gep p, C, C2, ...)) -> gep(relocate(p), C, C2, ...) break; } + + case Intrinsic::experimental_guard: { + Value *IIOperand = II->getArgOperand(0); + + // Remove a guard if it is immediately followed by an identical guard. + if (match(II->getNextNode(), + m_Intrinsic<Intrinsic::experimental_guard>(m_Specific(IIOperand)))) + return eraseInstFromFunction(*II); + break; + } } return visitCallSite(II); |

