[PATCH] D115924: [ConstantFolding] Unify handling of load from uniform value

Cameron McInally via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 6 10:50:44 PDT 2022


cameron.mcinally added inline comments.
Herald added a project: All.


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:722
+      (Ty->isIntOrIntVectorTy() || Ty->isFPOrFPVectorTy()))
+    return Constant::getAllOnesValue(Ty);
+  return nullptr;
----------------
Sorry for the late comment, but is this legal to do if the src and dest types are different sizes? E.g.:

```
%xxx_cast = bitcast i8* %xxx to i1*
store i1 true, i1* %xxx_cast
%yyy = load i8, i8* %xxx
```

In this case, we'll be turning an i1 -1 into an i8 -1, which changes bits.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115924



More information about the cfe-commits mailing list