mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-04 07:32:13 +00:00
Reapply r121886, and also update DecomposeGEPExpression to keep
it in sync. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121895 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e69b4ab829
commit
c01895c7db
@ -27,6 +27,7 @@
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Analysis/CaptureTracking.h"
|
||||
#include "llvm/Analysis/MemoryBuiltins.h"
|
||||
#include "llvm/Analysis/InstructionSimplify.h"
|
||||
#include "llvm/Analysis/ValueTracking.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
@ -262,6 +263,14 @@ DecomposeGEPExpression(const Value *V, int64_t &BaseOffs,
|
||||
V = Op->getOperand(0);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (const Instruction *I = dyn_cast<Instruction>(V))
|
||||
// TODO: Get a DominatorTree and use it here.
|
||||
if (const Value *Simplified =
|
||||
SimplifyInstruction(const_cast<Instruction *>(I), TD)) {
|
||||
V = Simplified;
|
||||
continue;
|
||||
}
|
||||
|
||||
const GEPOperator *GEPOp = dyn_cast<GEPOperator>(Op);
|
||||
if (GEPOp == 0)
|
||||
|
@ -1441,6 +1441,14 @@ Value *llvm::GetUnderlyingObject(Value *V, unsigned MaxLookup) {
|
||||
return V;
|
||||
V = GA->getAliasee();
|
||||
} else {
|
||||
// See if InstructionSimplify knows any relevant tricks.
|
||||
if (Instruction *I = dyn_cast<Instruction>(V))
|
||||
// TODO: Aquire TargetData and DominatorTree and use them.
|
||||
if (Value *Simplified = SimplifyInstruction(I, 0, 0)) {
|
||||
V = Simplified;
|
||||
continue;
|
||||
}
|
||||
|
||||
return V;
|
||||
}
|
||||
assert(V->getType()->isPointerTy() && "Unexpected operand type!");
|
||||
|
Loading…
x
Reference in New Issue
Block a user