From 0efb96a8ee1b57c39fb732a098f88b3410fc4aeb Mon Sep 17 00:00:00 2001 From: James Molloy Date: Mon, 19 Sep 2016 08:23:08 +0000 Subject: [SimplifyCFG] Update (AND) IR flags when CSE'ing instructions We were updating metadata but not IR flags. Because we pick an arbitrary instruction to be the CSE candidate, it comes down to luck (50% or less chance) if this results in broken codegen or not, which is why PR30373 which is actually not the fault of the commit it was bisected down to. Fixes PR30373. llvm-svn: 281889 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp') diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 877e55928d4..90ce6720182 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1527,10 +1527,12 @@ static bool sinkLastInstruction(ArrayRef Blocks) { I0->getOperandUse(O).set(NewOperands[O]); I0->moveBefore(&*BBEnd->getFirstInsertionPt()); - // Update metadata. + // Update metadata and IR flags. for (auto *I : Insts) - if (I != I0) + if (I != I0) { combineMetadataForCSE(I0, I); + I0->andIRFlags(I); + } if (!isa(I0)) { // canSinkLastInstruction checked that all instructions were used by -- cgit v1.2.3