[PATCH] D63967: Handle IntToPtr in isBytewiseValue

Vitaly Buka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 11 14:08:21 PDT 2019


vitalybuka marked an inline comment as done.
vitalybuka added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:3222
 
+  if (auto *CE = dyn_cast<ConstantExpr>(C)) {
+    if (CE->getOpcode() == Instruction::IntToPtr) {
----------------
@pcc BTW, your original patch just gave up on size mismatch
Something like:
```
if (auto *CE = dyn_cast<ConstantExpr>(C)) {
    if (CE->getOpcode() == Instruction::IntToPtr &&
        cast<IntegerType>(CE->getOperand(0)->getType())->getBitWidth() ==
            DL.getPointerSizeInBits(
                cast<PointerType>(CE->getType())->getAddressSpace())) {
      return isBytewiseValue(CE->getOperand(0), DL);
    }
    return nullptr;
  }
```

Both versions affect binary size about the same.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63967/new/

https://reviews.llvm.org/D63967





More information about the cfe-commits mailing list