Skip to content

Commit 06d5670

Browse files
committed
[InstSimplify] Respect CanUseUndef in more places
Similar to what we do in IIQ, add an isUndefValue() helper that checks for undef values while respective CanUseUndef. This makes it much easier to search for places that don't respect the flag yet.
1 parent 254e0ab commit 06d5670

File tree

2 files changed

+64
-54
lines changed

2 files changed

+64
-54
lines changed

llvm/include/llvm/Analysis/InstructionSimplify.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@ struct SimplifyQuery {
123123
Copy.CanUseUndef = false;
124124
return Copy;
125125
}
126+
127+
/// If CanUseUndef is true, returns whether \p V is undef.
128+
/// Otherwise always return false.
129+
bool isUndefValue(Value *V) const {
130+
if (!CanUseUndef)
131+
return false;
132+
return isa<UndefValue>(V);
133+
}
126134
};
127135

128136
// NOTE: the explicit multiple argument versions of these functions are

0 commit comments

Comments
 (0)