[llvm] 2d67a86 - [SCEVExpander] Use IntToPtr for temporary instruction.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 11 01:40:46 PST 2022
Author: Florian Hahn
Date: 2022-01-11T09:40:21Z
New Revision: 2d67a86b7c14a4f3686e50608a80adb5e7b5cb92
URL: https://github.com/llvm/llvm-project/commit/2d67a86b7c14a4f3686e50608a80adb5e7b5cb92
DIFF: https://github.com/llvm/llvm-project/commit/2d67a86b7c14a4f3686e50608a80adb5e7b5cb92.diff
LOG: [SCEVExpander] Use IntToPtr for temporary instruction.
Use PtrToInt instead Add when creating temporary instructions. The add
might get folded away with more sophisticated folding.
Added:
Modified:
llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
index b41b63432c3dd..fe8215d3b9916 100644
--- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
@@ -1843,8 +1843,8 @@ Value *SCEVExpander::expandCodeForImpl(const SCEV *SH, Type *Ty, bool Root) {
// instruction.
Instruction *Tmp;
if (Inst->getType()->isIntegerTy())
- Tmp =
- cast<Instruction>(Builder.CreateAdd(Inst, Inst, "tmp.lcssa.user"));
+ Tmp = cast<Instruction>(Builder.CreateIntToPtr(
+ Inst, Inst->getType()->getPointerTo(), "tmp.lcssa.user"));
else {
assert(Inst->getType()->isPointerTy());
Tmp = cast<Instruction>(Builder.CreatePtrToInt(
More information about the llvm-commits
mailing list