mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Teach InstructionSimplify about phi nodes. I chose to have it simply
offload the work to hasConstantValue rather than do something more complicated (such handling mutually recursive phis) because (1) it is not clear it is worth it; and (2) if it is worth it, maybe such logic would be better placed in hasConstantValue. Adjust some GVN tests which are now cleaned up much further (eg: all phi nodes are removed). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119043 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "InstCombine.h"
|
||||
#include "llvm/Analysis/InstructionSimplify.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
@@ -731,8 +732,8 @@ Instruction *InstCombiner::SliceUpIllegalIntegerPHI(PHINode &FirstPhi) {
|
||||
Instruction *InstCombiner::visitPHINode(PHINode &PN) {
|
||||
// If LCSSA is around, don't mess with Phi nodes
|
||||
if (MustPreserveLCSSA) return 0;
|
||||
|
||||
if (Value *V = PN.hasConstantValue())
|
||||
|
||||
if (Value *V = SimplifyInstruction(&PN, TD))
|
||||
return ReplaceInstUsesWith(PN, V);
|
||||
|
||||
// If all PHI operands are the same operation, pull them through the PHI,
|
||||
|
Reference in New Issue
Block a user