-
-
Save nikic/7e1301a81542d95953a44243c8ee5b5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit b8948971566e3742854212b09f83df706e17e475 | |
Author: Nikita Popov <nikita.ppv@gmail.com> | |
Date: Sun Dec 6 21:03:04 2020 +0100 | |
lsr postinc | |
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | |
index c7e37fe0d1b..aa23e244bbc 100644 | |
--- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | |
+++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | |
@@ -18,6 +18,7 @@ | |
#include "llvm/Analysis/InstructionSimplify.h" | |
#include "llvm/Analysis/LoopInfo.h" | |
#include "llvm/Analysis/TargetTransformInfo.h" | |
+#include "llvm/Analysis/ValueTracking.h" | |
#include "llvm/IR/DataLayout.h" | |
#include "llvm/IR/Dominators.h" | |
#include "llvm/IR/IntrinsicInst.h" | |
@@ -1440,6 +1441,10 @@ Value *SCEVExpander::expandAddRecExprLiterally(const SCEVAddRecExpr *S) { | |
assert(LatchBlock && "PostInc mode requires a unique loop latch!"); | |
Result = PN->getIncomingValueForBlock(LatchBlock); | |
+ if (auto *I = dyn_cast<Instruction>(Result)) | |
+ if (!programUndefinedIfPoison(I)) | |
+ I->dropPoisonGeneratingFlags(); | |
+ | |
// For an expansion to use the postinc form, the client must call | |
// expandCodeFor with an InsertPoint that is either outside the PostIncLoop | |
// or dominated by IVIncInsertPos. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment