Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 5cb2954

Browse files
committed
Analysis: Return early for UndefValue in computeKnownBits
There is no benefit in looking through assumptions on UndefValue to guess known bits. Return early to avoid walking their use-lists, and assert that all instances of ConstantData are handled here for similar reasons (UndefValue was the only integer/pointer holdout). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282337 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent c7ebf69 commit 5cb2954

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/Analysis/ValueTracking.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,14 @@ void computeKnownBits(const Value *V, APInt &KnownZero, APInt &KnownOne,
15021502
// Start out not knowing anything.
15031503
KnownZero.clearAllBits(); KnownOne.clearAllBits();
15041504

1505+
// We can't imply anything about undefs.
1506+
if (isa<UndefValue>(V))
1507+
return;
1508+
1509+
// There's no point in looking through other users of ConstantData for
1510+
// assumptions. Confirm that we've handled them all.
1511+
assert(!isa<ConstantData>(V) && "Unhandled constant data!");
1512+
15051513
// Limit search depth.
15061514
// All recursive calls that increase depth must come after this.
15071515
if (Depth == MaxDepth)

0 commit comments

Comments
 (0)