diff options
author | Arnaud A. de Grandmaison <arnaud.adegm@gmail.com> | 2013-03-22 08:25:01 +0000 |
---|---|---|
committer | Arnaud A. de Grandmaison <arnaud.adegm@gmail.com> | 2013-03-22 08:25:01 +0000 |
commit | 2be921adc41fb079ce25d36bdd6402ca70d56451 (patch) | |
tree | b978b2527e562b389d6c3fa4a4ca6ab0a17c399b /include/llvm/IR/DataLayout.h | |
parent | 9b294d4056f47bac5985de89c847aa1a04d38bf0 (diff) |
InstCombine: Improve the result bitvect type when folding (cmp pred (load (gep GV, i)) C) to a bit test.
The original code used i32, and i64 if legal. This introduced unneeded
casts when they aren't legal, or when the index variable i has another
type. In order of preference: try to use i's type; use the smallest
fitting legal type (using an added DataLayout method); default to i32.
A testcase checks that this works when the index gep operand is i16.
Patch by : Ahmed Bougacha <ahmed.bougacha@gmail.com>
Reviewed by : Duncan
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177712 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/IR/DataLayout.h')
-rw-r--r-- | include/llvm/IR/DataLayout.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/llvm/IR/DataLayout.h b/include/llvm/IR/DataLayout.h index 72b4eedabd..547d857b7b 100644 --- a/include/llvm/IR/DataLayout.h +++ b/include/llvm/IR/DataLayout.h @@ -352,6 +352,10 @@ public: /// type. Type *getIntPtrType(Type *) const; + /// getSmallestLegalIntType - Return the smallest integer type with size at + /// least as big as Width bits. + Type *getSmallestLegalIntType(LLVMContext &C, unsigned Width = 0) const; + /// getIndexedOffset - return the offset from the beginning of the type for /// the specified indices. This is used to implement getelementptr. uint64_t getIndexedOffset(Type *Ty, ArrayRef<Value *> Indices) const; |