From 0b7ecee988cd936b92e191fba248e72a8e936ccf Mon Sep 17 00:00:00 2001 From: Fiona Glaser Date: Tue, 3 Nov 2015 22:23:39 +0000 Subject: [PATCH] InstCombine: fix sinking of convergent calls git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251991 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/InstCombine/InstructionCombining.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp index b51ec291f91..ac535f97bb1 100644 --- a/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -2694,6 +2694,12 @@ static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) { &DestBlock->getParent()->getEntryBlock()) return false; + // Do not sink convergent call instructions. + if (auto *CI = dyn_cast(I)) { + if (CI->isConvergent()) + return false; + } + // We can only sink load instructions if there is nothing between the load and // the end of block that could change the value. if (I->mayReadFromMemory()) { -- 2.34.1