Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(537)

Unified Diff: lib/Transforms/NaCl/ReplacePtrsWithInts.cpp

Issue 29743003: Add passes for applying SFI sandboxing at the LLVM IR level Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Retry upload Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/Transforms/NaCl/FlattenGlobals.cpp ('k') | lib/Transforms/NaCl/SandboxIndirectCalls.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Transforms/NaCl/ReplacePtrsWithInts.cpp
diff --git a/lib/Transforms/NaCl/ReplacePtrsWithInts.cpp b/lib/Transforms/NaCl/ReplacePtrsWithInts.cpp
index 2fbe1b8e6040319be711a0205a16a03df0930c12..24a409b701d7874dc11073eee3bb93f94fc36447 100644
--- a/lib/Transforms/NaCl/ReplacePtrsWithInts.cpp
+++ b/lib/Transforms/NaCl/ReplacePtrsWithInts.cpp
@@ -513,8 +513,11 @@ static void SimplifyCasts(Instruction *Inst, Type *IntPtrType) {
if (PtrToIntInst *Cast2 = dyn_cast<PtrToIntInst>(Cast1->getOperand(0))) {
assert(Cast2->getType() == IntPtrType);
Value *V = Cast2->getPointerOperand();
- if (V->getType() != Cast1->getType())
+ if (V->getType() != Cast1->getType()) {
+ // Hack: don't convert to bitcast.
+ return;
V = new BitCastInst(V, Cast1->getType(), V->getName() + ".bc", Cast1);
+ }
Cast1->replaceAllUsesWith(V);
if (Cast1->use_empty())
Cast1->eraseFromParent();
« no previous file with comments | « lib/Transforms/NaCl/FlattenGlobals.cpp ('k') | lib/Transforms/NaCl/SandboxIndirectCalls.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698